UNPKG

@tencentcloud/roomkit-electron-vue3

Version:

<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,

29 lines (28 loc) 859 B
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const nodeMap = /* @__PURE__ */ new Map(); const vClickOutside = { mounted(el, binding) { const listenerFunction = (event) => { if (el.contains(event.target)) { return; } if (binding.value && typeof binding.value === "function") { binding.value(event); } }; if (!nodeMap.has(el)) { nodeMap.set(el, []); } const nodeCallbackList = nodeMap.get(el); nodeCallbackList.push(listenerFunction); document.addEventListener("click", listenerFunction); }, unmounted(el) { const nodeCallbackList = nodeMap.get(el); nodeCallbackList.forEach((callback) => { document.removeEventListener("click", callback); }); } }; exports.default = vClickOutside;