package.lib.directives.resize.index.mjs Maven / Gradle / Ivy
// Types
function mounted(el, binding) {
const handler = binding.value;
const options = {
passive: !binding.modifiers?.active
};
window.addEventListener('resize', handler, options);
el._onResize = Object(el._onResize);
el._onResize[binding.instance.$.uid] = {
handler,
options
};
if (!binding.modifiers?.quiet) {
handler();
}
}
function unmounted(el, binding) {
if (!el._onResize?.[binding.instance.$.uid]) return;
const {
handler,
options
} = el._onResize[binding.instance.$.uid];
window.removeEventListener('resize', handler, options);
delete el._onResize[binding.instance.$.uid];
}
export const Resize = {
mounted,
unmounted
};
export default Resize;
//# sourceMappingURL=index.mjs.map