ember-mutation-observer-modifier v1.0.1
ember-mutation-observer-modifier
Use MutationObserver through an Ember Modifier
Compatibility
- Ember.js v3.12 or above
- Ember CLI v2.13 or above
- Node.js v10 or above
Installation
ember install ember-mutation-observer-modifierUsage
This addon provides an Ember modifier for attaching a MutationObserver to an element in your Ember template and calling an action when the observer fires. All configuration options supported by MutationObserver#observe are supported through the modifier.
In the following example, this.onChange will be called any time that this.someAttrValue is changed on the div, by observing the changes to the some-attr attribute.
<div some-attr={{this.someAttrValue}} {{observe-mutation this.onChange attributes=true}} />Note that options for the MutationObserver can also be provided as the second positional parameter to the modifier.
<div some-attr={{this.someAttrValue}} {{observe-mutation this.onChange (hash attributes=true)}} />Please consult the documentation for MutationObserverInit for a full list of supported parameters.
Contributing
See the Contributing guide for details.
License
This project is licensed under the MIT License.