MCPcopy
hub / github.com/vuejs/composition-api / queueFlushJob

Function queueFlushJob

src/apis/watch.ts:133–166  ·  view source on GitHub ↗
(
  vm: any,
  fn: () => void,
  mode: Exclude<FlushMode, 'sync'>
)

Source from the content-addressed store, hash-verified

131}
132
133function 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
168function createVueWatcher(
169 vm: ComponentInstance,

Callers 1

createSchedulerFunction · 0.85

Calls 2

assertFunction · 0.90
fallbackFlushFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…