scheduler.ts — vue Source File
Architecture documentation for scheduler.ts, a typescript file in the vue codebase. 8 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 7cc5a667_1876_f28e_e26f_27fcdcba292e["scheduler.ts"] acd39cb4_1b40_1f96_d7d8_00ba7dc7b283["watcher.ts"] 7cc5a667_1876_f28e_e26f_27fcdcba292e --> acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 d22f3dff_cc24_705a_1193_eec206dcb1d5["config.ts"] 7cc5a667_1876_f28e_e26f_27fcdcba292e --> d22f3dff_cc24_705a_1193_eec206dcb1d5 dfb2b3e1_ffba_6029_124e_b43a30f0f999["dep.ts"] 7cc5a667_1876_f28e_e26f_27fcdcba292e --> dfb2b3e1_ffba_6029_124e_b43a30f0f999 f3560440_54c1_5663_36f8_c7de54d7310b["lifecycle.ts"] 7cc5a667_1876_f28e_e26f_27fcdcba292e --> f3560440_54c1_5663_36f8_c7de54d7310b f8064a1e_1b6a_274a_f334_111faf594604["callHook"] 7cc5a667_1876_f28e_e26f_27fcdcba292e --> f8064a1e_1b6a_274a_f334_111faf594604 c839785a_cc49_21a8_563d_d8789c68747b["activateChildComponent"] 7cc5a667_1876_f28e_e26f_27fcdcba292e --> c839785a_cc49_21a8_563d_d8789c68747b 2a298df2_21b8_7e5a_c372_51ba50c9d92d["index.ts"] 7cc5a667_1876_f28e_e26f_27fcdcba292e --> 2a298df2_21b8_7e5a_c372_51ba50c9d92d 907f4994_ea28_43b1_7976_0db9f0e97637["component"] 7cc5a667_1876_f28e_e26f_27fcdcba292e --> 907f4994_ea28_43b1_7976_0db9f0e97637 acd39cb4_1b40_1f96_d7d8_00ba7dc7b283["watcher.ts"] acd39cb4_1b40_1f96_d7d8_00ba7dc7b283 --> 7cc5a667_1876_f28e_e26f_27fcdcba292e 38aa88fe_678d_7728_4258_240bdb85b32b["apiWatch.ts"] 38aa88fe_678d_7728_4258_240bdb85b32b --> 7cc5a667_1876_f28e_e26f_27fcdcba292e style 7cc5a667_1876_f28e_e26f_27fcdcba292e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type Watcher from './watcher'
import config from '../config'
import Dep, { cleanupDeps } from './dep'
import { callHook, activateChildComponent } from '../instance/lifecycle'
import { warn, nextTick, devtools, inBrowser, isIE } from '../util/index'
import type { Component } from 'types/component'
export const MAX_UPDATE_COUNT = 100
const queue: Array<Watcher> = []
const activatedChildren: Array<Component> = []
let has: { [key: number]: true | undefined | null } = {}
let circular: { [key: number]: number } = {}
let waiting = false
let flushing = false
let index = 0
/**
* Reset the scheduler's state.
*/
function resetSchedulerState() {
index = queue.length = activatedChildren.length = 0
has = {}
if (__DEV__) {
circular = {}
}
waiting = flushing = false
}
// Async edge case #6566 requires saving the timestamp when event listeners are
// attached. However, calling performance.now() has a perf overhead especially
// if the page has thousands of event listeners. Instead, we take a timestamp
// every time the scheduler flushes and use that for all event listeners
// attached during that flush.
export let currentFlushTimestamp = 0
// Async edge case fix requires storing an event listener's attach timestamp.
let getNow: () => number = Date.now
// Determine what event timestamp the browser is using. Annoyingly, the
// timestamp can either be hi-res (relative to page load) or low-res
// (relative to UNIX epoch), so in order to compare time we have to use the
// same timestamp type when saving the flush timestamp.
// All IE versions use low-res event timestamps, and have problematic clock
// implementations (#9632)
if (inBrowser && !isIE) {
const performance = window.performance
if (
performance &&
typeof performance.now === 'function' &&
getNow() > document.createEvent('Event').timeStamp
) {
// if the event timestamp, although evaluated AFTER the Date.now(), is
// smaller than it, it means the event is using a hi-res timestamp,
// and we need to use the hi-res version for event listener timestamps as
// well.
getNow = () => performance.now()
}
}
// ... (140 more lines)
Domain
Subdomains
Functions
Dependencies
Imported By
Source
Frequently Asked Questions
What does scheduler.ts do?
scheduler.ts is a source file in the vue codebase, written in typescript. It belongs to the CoreRuntime domain, Observer subdomain.
What functions are defined in scheduler.ts?
scheduler.ts defines 8 function(s): callActivatedHooks, callUpdatedHooks, flushSchedulerQueue, getNow, queueActivatedComponent, queueWatcher, resetSchedulerState, sortCompareFn.
What does scheduler.ts depend on?
scheduler.ts imports 8 module(s): activateChildComponent, callHook, component, config.ts, dep.ts, index.ts, lifecycle.ts, watcher.ts.
What files import scheduler.ts?
scheduler.ts is imported by 2 file(s): apiWatch.ts, watcher.ts.
Where is scheduler.ts in the architecture?
scheduler.ts is located at src/core/observer/scheduler.ts (domain: CoreRuntime, subdomain: Observer, directory: src/core/observer).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free