events.ts — vue Source File
Architecture documentation for events.ts, a typescript file in the vue codebase. 7 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR fa3254df_d7fb_4fb8_94ec_97ddce44d626["events.ts"] 09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"] fa3254df_d7fb_4fb8_94ec_97ddce44d626 --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b 0b94d479_4c91_cb17_f853_bbf7580e667b["index"] fa3254df_d7fb_4fb8_94ec_97ddce44d626 --> 0b94d479_4c91_cb17_f853_bbf7580e667b 90a2398a_1498_3263_c62e_0c064dd2c9b3["index"] fa3254df_d7fb_4fb8_94ec_97ddce44d626 --> 90a2398a_1498_3263_c62e_0c064dd2c9b3 7f1b7ba7_30dd_83df_3e82_76fad161febf["model"] fa3254df_d7fb_4fb8_94ec_97ddce44d626 --> 7f1b7ba7_30dd_83df_3e82_76fad161febf af685b49_362f_04d6_83f7_0b2ffece0105["scheduler"] fa3254df_d7fb_4fb8_94ec_97ddce44d626 --> af685b49_362f_04d6_83f7_0b2ffece0105 7f2e8dff_3298_ebe0_d86e_250235fb5e75["patch"] fa3254df_d7fb_4fb8_94ec_97ddce44d626 --> 7f2e8dff_3298_ebe0_d86e_250235fb5e75 ba925ef2_b0f4_efe3_c23d_fe293c46b2c1["vnode"] fa3254df_d7fb_4fb8_94ec_97ddce44d626 --> ba925ef2_b0f4_efe3_c23d_fe293c46b2c1 7973a695_d0db_6940_134b_f6ff953b9e97["index.ts"] 7973a695_d0db_6940_134b_f6ff953b9e97 --> fa3254df_d7fb_4fb8_94ec_97ddce44d626 style fa3254df_d7fb_4fb8_94ec_97ddce44d626 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { isDef, isUndef } from 'shared/util'
import { updateListeners } from 'core/vdom/helpers/index'
import { isIE, isFF, supportsPassive, isUsingMicroTask } from 'core/util/index'
import {
RANGE_TOKEN,
CHECKBOX_RADIO_TOKEN
} from 'web/compiler/directives/model'
import { currentFlushTimestamp } from 'core/observer/scheduler'
import { emptyNode } from 'core/vdom/patch'
import type { VNodeWithData } from 'types/vnode'
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
// user-attached handlers.
function normalizeEvents(on) {
/* istanbul ignore if */
if (isDef(on[RANGE_TOKEN])) {
// IE input[type=range] only supports `change` event
const event = isIE ? 'change' : 'input'
on[event] = [].concat(on[RANGE_TOKEN], on[event] || [])
delete on[RANGE_TOKEN]
}
// This was originally intended to fix #4521 but no longer necessary
// after 2.5. Keeping it for backwards compat with generated code from < 2.4
/* istanbul ignore if */
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || [])
delete on[CHECKBOX_RADIO_TOKEN]
}
}
let target: any
function createOnceHandler(event, handler, capture) {
const _target = target // save current target element in closure
return function onceHandler() {
const res = handler.apply(null, arguments)
if (res !== null) {
remove(event, onceHandler, capture, _target)
}
}
}
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
// implementation and does not fire microtasks in between event propagation, so
// safe to exclude.
const useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53)
function add(
name: string,
handler: Function,
capture: boolean,
passive: boolean
) {
// async edge case #6566: inner click event triggers patch, event handler
// attached to outer element during patch, and triggered again. This
// happens because browsers fire microtask ticks between event propagation.
// the solution is simple: we save the timestamp when a handler is attached,
// and the handler would only fire if the event passed to it was fired
// ... (68 more lines)
Domain
Subdomains
Dependencies
- index
- index
- model
- patch
- scheduler
- util
- vnode
Imported By
Source
Frequently Asked Questions
What does events.ts do?
events.ts is a source file in the vue codebase, written in typescript. It belongs to the WebPlatform domain, WebRuntime subdomain.
What functions are defined in events.ts?
events.ts defines 6 function(s): add, createOnceHandler, default.destroy, normalizeEvents, remove, updateDOMListeners.
What does events.ts depend on?
events.ts imports 7 module(s): index, index, model, patch, scheduler, util, vnode.
What files import events.ts?
events.ts is imported by 1 file(s): index.ts.
Where is events.ts in the architecture?
events.ts is located at src/platforms/web/runtime/modules/events.ts (domain: WebPlatform, subdomain: WebRuntime, directory: src/platforms/web/runtime/modules).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free