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

Function flushSchedulerQueue

static/vuejs/vue.runtime.common.js:2307–2364  ·  view source on GitHub ↗

* Flush both queues and run the watchers.

()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

resetSchedulerStateFunction · 0.70
callHookFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected