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

11 lines
297 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]) {
const boundHandler = ev => handler(element, ev);
window.addEventListener('resize', boundHandler);
return () => {
window.removeEventListener('resize', boundHandler);
};
});