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 36c7708b_24b4_08c9_e39f_50f332a4b206["scheduler.ts"] 093a7a23_fa4b_6464_b268_8f9d10bcaa2f["watcher.ts"] 36c7708b_24b4_08c9_e39f_50f332a4b206 --> 093a7a23_fa4b_6464_b268_8f9d10bcaa2f 81a11719_3457_ecad_7c86_c586d804debb["config.ts"] 36c7708b_24b4_08c9_e39f_50f332a4b206 --> 81a11719_3457_ecad_7c86_c586d804debb e5c4d6ab_2495_a6d4_d962_9d9f71bf3114["dep.ts"] 36c7708b_24b4_08c9_e39f_50f332a4b206 --> e5c4d6ab_2495_a6d4_d962_9d9f71bf3114 d937f76e_061f_a631_9587_336503c9a15c["lifecycle.ts"] 36c7708b_24b4_08c9_e39f_50f332a4b206 --> d937f76e_061f_a631_9587_336503c9a15c 77ac8989_609a_4755_79eb_0403c1cc7788["callHook"] 36c7708b_24b4_08c9_e39f_50f332a4b206 --> 77ac8989_609a_4755_79eb_0403c1cc7788 428cbd6d_51c5_fed9_65af_f319e424b217["activateChildComponent"] 36c7708b_24b4_08c9_e39f_50f332a4b206 --> 428cbd6d_51c5_fed9_65af_f319e424b217 76672dd6_4e87_4468_a48b_f4da793fd211["index.ts"] 36c7708b_24b4_08c9_e39f_50f332a4b206 --> 76672dd6_4e87_4468_a48b_f4da793fd211 64c87498_c46a_6944_ab9d_8e45519852a8["component"] 36c7708b_24b4_08c9_e39f_50f332a4b206 --> 64c87498_c46a_6944_ab9d_8e45519852a8 093a7a23_fa4b_6464_b268_8f9d10bcaa2f["watcher.ts"] 093a7a23_fa4b_6464_b268_8f9d10bcaa2f --> 36c7708b_24b4_08c9_e39f_50f332a4b206 e5380f01_49bc_d965_1141_151fb5c6c097["apiWatch.ts"] e5380f01_49bc_d965_1141_151fb5c6c097 --> 36c7708b_24b4_08c9_e39f_50f332a4b206 style 36c7708b_24b4_08c9_e39f_50f332a4b206 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 VueCore 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: VueCore, 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