off() — vite Function Reference
Architecture documentation for the off() function in hmr.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 0e7590d6_da27_d1a7_ad53_e83555f6c9e5["off()"] d86a8333_3c9a_922b_57b2_926575326289["HMRContext"] 0e7590d6_da27_d1a7_ad53_e83555f6c9e5 -->|defined in| d86a8333_3c9a_922b_57b2_926575326289 style 0e7590d6_da27_d1a7_ad53_e83555f6c9e5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/shared/hmr.ts lines 130–148
off<T extends string>(
event: T,
cb: (payload: InferCustomEventPayload<T>) => void,
): void {
const removeFromMap = (map: Map<string, any[]>) => {
const existing = map.get(event)
if (existing === undefined) {
return
}
const pruned = existing.filter((l) => l !== cb)
if (pruned.length === 0) {
map.delete(event)
return
}
map.set(event, pruned)
}
removeFromMap(this.hmrClient.customListenersMap)
removeFromMap(this.newListeners)
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does off() do?
off() is a function in the vite codebase, defined in packages/vite/src/shared/hmr.ts.
Where is off() defined?
off() is defined in packages/vite/src/shared/hmr.ts at line 130.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free