UNPKG

@razz21/vue-scan

Version:

Track and visualize Vue 3 component renders

35 lines (34 loc) 925 B
import { logger as t } from "../utils/logger.js"; function f() { if (typeof window > "u") { t.error("window is not available"); return; } return window.__VUE_DEVTOOLS_GLOBAL_HOOK__ ??= { appRecords: [], enabled: !0, events: /* @__PURE__ */ new Map(), on(e, o) { this.events.has(e) || this.events.set(e, []), this.events.get(e).push(o); }, once(e, o) { t.debug("once", e); const s = (...i) => { o(...i), this.off(e, s); }; this.on(e, s); }, emit(e, ...o) { t.debug("emit", e, o), this.events.has(e) && this.events.get(e).forEach((s) => s(...o)); }, off(e, o) { if (t.debug("off", e), !this.events.has(e)) return; const s = this.events.get(e), i = s.indexOf(o); i !== -1 && s.splice(i, 1); } }, window.__VUE_DEVTOOLS_GLOBAL_HOOK__; } export { f as createDevToolsHook }; //# sourceMappingURL=hook.js.map