( vm: any, fn: () => void, mode: Exclude<FlushMode, 'sync'> )
| 131 | } |
| 132 | |
| 133 | function queueFlushJob( |
| 134 | vm: any, |
| 135 | fn: () => void, |
| 136 | mode: Exclude<FlushMode, 'sync'> |
| 137 | ) { |
| 138 | // flush all when beforeUpdate and updated are not fired |
| 139 | const fallbackFlush = () => { |
| 140 | vm.$nextTick(() => { |
| 141 | if (vm[WatcherPreFlushQueueKey].length) { |
| 142 | flushQueue(vm, WatcherPreFlushQueueKey) |
| 143 | } |
| 144 | if (vm[WatcherPostFlushQueueKey].length) { |
| 145 | flushQueue(vm, WatcherPostFlushQueueKey) |
| 146 | } |
| 147 | }) |
| 148 | } |
| 149 | |
| 150 | switch (mode) { |
| 151 | case 'pre': |
| 152 | fallbackFlush() |
| 153 | vm[WatcherPreFlushQueueKey].push(fn) |
| 154 | break |
| 155 | case 'post': |
| 156 | fallbackFlush() |
| 157 | vm[WatcherPostFlushQueueKey].push(fn) |
| 158 | break |
| 159 | default: |
| 160 | assert( |
| 161 | false, |
| 162 | `flush must be one of ["post", "pre", "sync"], but got ${mode}` |
| 163 | ) |
| 164 | break |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | function createVueWatcher( |
| 169 | vm: ComponentInstance, |
no test coverage detected
searching dependent graphs…