open-nomad/ui/app/modifiers/window-resize.js
2022-01-20 09:46:45 -05:00

11 lines
299 B
JavaScript

import { modifier } from 'ember-modifier';
export default modifier(function windowResize(element, [handler]) {
const boundHandler = (ev) => handler(element, ev);
window.addEventListener('resize', boundHandler);
return () => {
window.removeEventListener('resize', boundHandler);
};
});