index.mjs 745 B

1234567891011121314151617181920212223242526272829303132
  1. // Types
  2. function mounted(el, binding) {
  3. const handler = binding.value;
  4. const options = {
  5. passive: !binding.modifiers?.active
  6. };
  7. window.addEventListener('resize', handler, options);
  8. el._onResize = Object(el._onResize);
  9. el._onResize[binding.instance.$.uid] = {
  10. handler,
  11. options
  12. };
  13. if (!binding.modifiers?.quiet) {
  14. handler();
  15. }
  16. }
  17. function unmounted(el, binding) {
  18. if (!el._onResize?.[binding.instance.$.uid]) return;
  19. const {
  20. handler,
  21. options
  22. } = el._onResize[binding.instance.$.uid];
  23. window.removeEventListener('resize', handler, options);
  24. delete el._onResize[binding.instance.$.uid];
  25. }
  26. export const Resize = {
  27. mounted,
  28. unmounted
  29. };
  30. export default Resize;
  31. //# sourceMappingURL=index.mjs.map