MCPcopy Create free account
hub / github.com/TruthHun/BookStack / flushSchedulerQueue

Function flushSchedulerQueue

static/vuejs/vue.runtime.esm.js:2305–2362  ·  view source on GitHub ↗

* Flush both queues and run the watchers.

()

Source from the content-addressed store, hash-verified

2303 * Flush both queues and run the watchers.
2304 */
2305function flushSchedulerQueue () {
2306 flushing = true;
2307 var watcher, id, vm;
2308
2309 // Sort queue before flush.
2310 // This ensures that:
2311 // 1. Components are updated from parent to child. (because parent is always
2312 // created before the child)
2313 // 2. A component's user watchers are run before its render watcher (because
2314 // user watchers are created before the render watcher)
2315 // 3. If a component is destroyed during a parent component's watcher run,
2316 // its watchers can be skipped.
2317 queue.sort(function (a, b) { return a.id - b.id; });
2318
2319 // do not cache length because more watchers might be pushed
2320 // as we run existing watchers
2321 for (index = 0; index < queue.length; index++) {
2322 watcher = queue[index];
2323 id = watcher.id;
2324 has[id] = null;
2325 watcher.run();
2326 // in dev build, check and stop circular updates.
2327 if (process.env.NODE_ENV !== 'production' && has[id] != null) {
2328 circular[id] = (circular[id] || 0) + 1;
2329 if (circular[id] > config._maxUpdateCount) {
2330 warn(
2331 'You may have an infinite update loop ' + (
2332 watcher.user
2333 ? ("in watcher with expression \"" + (watcher.expression) + "\"")
2334 : "in a component render function."
2335 ),
2336 watcher.vm
2337 );
2338 break
2339 }
2340 }
2341 }
2342
2343 // reset scheduler before updated hook called
2344 var oldQueue = queue.slice();
2345 resetSchedulerState();
2346
2347 // call updated hooks
2348 index = oldQueue.length;
2349 while (index--) {
2350 watcher = oldQueue[index];
2351 vm = watcher.vm;
2352 if (vm._watcher === watcher && vm._isMounted) {
2353 callHook(vm, 'updated');
2354 }
2355 }
2356
2357 // devtool hook
2358 /* istanbul ignore if */
2359 if (devtools && config.devtools) {
2360 devtools.emit('flush');
2361 }
2362}

Callers

nothing calls this directly

Calls 3

resetSchedulerStateFunction · 0.70
callHookFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected