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

Function flushSchedulerQueue

static/vuejs/vue.runtime.js:2311–2368  ·  view source on GitHub ↗

* Flush both queues and run the watchers.

()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

resetSchedulerStateFunction · 0.70
callHookFunction · 0.70
warnFunction · 0.50

Tested by

no test coverage detected