UNPKG

@manusanchev/vue3-clickaway

Version:

Vue 3 directive to detect clickaway events

3 lines (2 loc) 456 B
"use strict";var e=new WeakMap,t={mounted:function(t,n){var o=function(e){t.contains(e.target)||n.value(e)};e.set(t,o),document.addEventListener("mousedown",o),document.addEventListener("touchstart",o)},beforeUnmount:function(t){var n=e.get(t);n&&(document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n),e.delete(t))}},n={install:function(e){e.directive("clickaway",t)}};module.exports=n; //# sourceMappingURL=index.js.map