open-nomad/ui/app/modifiers/window-resize.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
299 B
JavaScript
Raw Normal View History

2020-09-04 07:42:51 +00:00
import { modifier } from 'ember-modifier';
export default modifier(function windowResize(element, [handler]) {
2021-12-28 14:45:20 +00:00
const boundHandler = (ev) => handler(element, ev);
2020-09-04 07:42:51 +00:00
window.addEventListener('resize', boundHandler);
return () => {
window.removeEventListener('resize', boundHandler);
};
});