ember-async-observer-polyfill
v1.0.0
Published
Implement async observer support (emberjs/rfcs#494) for older Ember versions.
Downloads
113
Readme
ember-async-observer-polyfill
Implement's emberjs/rfcs#494 for older Ember versions.
Compatibility
- Completely inert when running Ember 3.13 or higher
- Supports Ember.js 2.12, 2.16, 2.18, 3.4, 3.8, 3.12
- Ember CLI v2.13 or above
- Node.js v10 or above
Installation
ember install ember-async-observer-polyfill
Usage
The best usage guide is the RFC itself emberjs/rfcs#494 but here are a few examples of "before"/"after" to whet your appetite:
Before:
const Person = EmberObject.extend({
firstName: null,
lastName: null,
fullName: computed('firstName', 'lastName', function() {
return `${this.firstName} ${this.lastName}`;
}),
fullNameChanged: observer('fullName', function() {
// do something :)
}),
});
After:
const Person = EmberObject.extend({
firstName: null,
lastName: null,
fullName: computed('firstName', 'lastName', function() {
return `${this.firstName} ${this.lastName}`;
}),
fullNameChanged: observer({
sync: false,
dependentKeys: ['fullName'],
fn() {
// do something :)
}
}),
});
Limitations
There are no known limitations, all features described in the RFC are polyfilled.
Contributing
See the Contributing guide for details.
License
This project is licensed under the MIT License.