events.ts — vue Source File
Architecture documentation for events.ts, a typescript file in the vue codebase. 3 imports, 3 dependents.
Entity Profile
Dependency Diagram
graph LR 8c1ef0ac_57c2_7f8a_7ea7_6924e38bf16b["events.ts"] 76672dd6_4e87_4468_a48b_f4da793fd211["index.ts"] 8c1ef0ac_57c2_7f8a_7ea7_6924e38bf16b --> 76672dd6_4e87_4468_a48b_f4da793fd211 cdac6c52_7988_97a3_c580_ce7bb214aaef["index.ts"] 8c1ef0ac_57c2_7f8a_7ea7_6924e38bf16b --> cdac6c52_7988_97a3_c580_ce7bb214aaef 64c87498_c46a_6944_ab9d_8e45519852a8["component"] 8c1ef0ac_57c2_7f8a_7ea7_6924e38bf16b --> 64c87498_c46a_6944_ab9d_8e45519852a8 23cfe098_8f89_2c1d_f6c8_39cd03563e3d["index.ts"] 23cfe098_8f89_2c1d_f6c8_39cd03563e3d --> 8c1ef0ac_57c2_7f8a_7ea7_6924e38bf16b ae790ceb_073b_1bcf_331c_af2d587c1ad6["init.ts"] ae790ceb_073b_1bcf_331c_af2d587c1ad6 --> 8c1ef0ac_57c2_7f8a_7ea7_6924e38bf16b d937f76e_061f_a631_9587_336503c9a15c["lifecycle.ts"] d937f76e_061f_a631_9587_336503c9a15c --> 8c1ef0ac_57c2_7f8a_7ea7_6924e38bf16b style 8c1ef0ac_57c2_7f8a_7ea7_6924e38bf16b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { Component } from 'types/component'
import {
tip,
toArray,
isArray,
hyphenate,
formatComponentName,
invokeWithErrorHandling
} from '../util/index'
import { updateListeners } from '../vdom/helpers/index'
export function initEvents(vm: Component) {
vm._events = Object.create(null)
vm._hasHookEvent = false
// init parent attached events
const listeners = vm.$options._parentListeners
if (listeners) {
updateComponentListeners(vm, listeners)
}
}
let target: any
function add(event, fn) {
target.$on(event, fn)
}
function remove(event, fn) {
target.$off(event, fn)
}
function createOnceHandler(event, fn) {
const _target = target
return function onceHandler() {
const res = fn.apply(null, arguments)
if (res !== null) {
_target.$off(event, onceHandler)
}
}
}
export function updateComponentListeners(
vm: Component,
listeners: Object,
oldListeners?: Object | null
) {
target = vm
updateListeners(
listeners,
oldListeners || {},
add,
remove,
createOnceHandler,
vm
)
target = undefined
}
export function eventsMixin(Vue: typeof Component) {
const hookRE = /^hook:/
// ... (101 more lines)
Domain
Subdomains
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 VueCore domain, Instance subdomain.
What functions are defined in events.ts?
events.ts defines 6 function(s): add, createOnceHandler, eventsMixin, initEvents, remove, updateComponentListeners.
What does events.ts depend on?
events.ts imports 3 module(s): component, index.ts, index.ts.
What files import events.ts?
events.ts is imported by 3 file(s): index.ts, init.ts, lifecycle.ts.
Where is events.ts in the architecture?
events.ts is located at src/core/instance/events.ts (domain: VueCore, subdomain: Instance, directory: src/core/instance).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free