Checkout the DEMO
Simplified and updated version of ember-resize.
Provides a mixin that you can use on your components, your components will have a didResize event called on them when appropriate.
Uses ember-singularity under the hood for efficient and massively gangster event handling.
ember install ember-resize-aware
Just mix this sucker into a component or any ember object with the didInsertElement lifecycle hooks.
import Component from '@ember/component';
import ResizeAware from 'ember-resize-aware/mixins/resize-aware';
export default Component.extend(ResizeAware, {
debounceRate: 400, // You can optionally set the debounce rate, the default is 200, 0 during testing.
didResize(width, height) {
// YOU GET THE WIDTH! AND THE HEIGHT! BOOM!
},
});git clone <repository-url>cd ember-resize-awareyarn install
yarn lint:jsyarn lint:js --fix
ember test– Runs the test suite on the current Ember versionember test --server– Runs the test suite in "watch mode"yarn test– Runsember try:eachto test your addon against multiple Ember versions
ember serve- Visit the dummy application at http://localhost:4200.
For more information on using ember-cli, visit https://ember-cli.com/.
This project is licensed under the MIT License.