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 7b0cc275_96e5_15f9_3ca6_626be691c291["events.ts"] 2a298df2_21b8_7e5a_c372_51ba50c9d92d["index.ts"] 7b0cc275_96e5_15f9_3ca6_626be691c291 --> 2a298df2_21b8_7e5a_c372_51ba50c9d92d ff42c1fb_00b4_0627_8802_37fe0cfb2e4d["index.ts"] 7b0cc275_96e5_15f9_3ca6_626be691c291 --> ff42c1fb_00b4_0627_8802_37fe0cfb2e4d 907f4994_ea28_43b1_7976_0db9f0e97637["component"] 7b0cc275_96e5_15f9_3ca6_626be691c291 --> 907f4994_ea28_43b1_7976_0db9f0e97637 950f6f82_5bc5_59dd_7664_e957d67dbb1d["index.ts"] 950f6f82_5bc5_59dd_7664_e957d67dbb1d --> 7b0cc275_96e5_15f9_3ca6_626be691c291 9e587547_0a20_aaaa_ba5c_6103ca27ef79["init.ts"] 9e587547_0a20_aaaa_ba5c_6103ca27ef79 --> 7b0cc275_96e5_15f9_3ca6_626be691c291 f3560440_54c1_5663_36f8_c7de54d7310b["lifecycle.ts"] f3560440_54c1_5663_36f8_c7de54d7310b --> 7b0cc275_96e5_15f9_3ca6_626be691c291 style 7b0cc275_96e5_15f9_3ca6_626be691c291 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 CoreRuntime 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: CoreRuntime, 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