1 | import nextTick from './next-tick'
|
2 | import { updateComponent } from './lifecycle'
|
3 |
|
4 | let items = []
|
5 |
|
6 | export function enqueueRender (component, isForceUpdate = false) {
|
7 |
|
8 | component._isForceUpdate = isForceUpdate
|
9 | if (!component._dirty && (component._dirty = true) && items.push(component) === 1) {
|
10 | nextTick(() => {
|
11 | rerender()
|
12 | })
|
13 | }
|
14 | }
|
15 |
|
16 | export function rerender () {
|
17 | let p
|
18 | const list = items
|
19 | items = []
|
20 |
|
21 | while ((p = list.pop())) {
|
22 | if (p._dirty) {
|
23 | updateComponent(p, true)
|
24 | }
|
25 | }
|
26 | }
|