"Immutable data structures which are backwards-compatible with normal Arrays and Objects" provided by the excellent Seamless Immutable library, wrapped and adapted for Ember.
- Seamless-immutable is imported from node_modules to Ember app (i.e., up-to-date, not bundled)
- Seamless-immutable is configured to your Ember app environment
- Immutable objects are made usable in Ember templates
- Helper that makes properties passed to a component immutable
Read more about it in "Exploring Immutability in Ember.js"
ember install ember-seamless-immutable
import immutable from 'immutable';
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return Ember.$.getJSON('/api/contacts').then(response => {
return immutable(response.contacts);
});
}
});
The default export immutable
is adapted for Ember. The original named export remains intact:
import { Immutable } from 'immutable';
See Seamless Immutable: API Overview.
{{contact-detail contact=(immutable contact)}}
An immutable contact object will be passed in to the component.
ember test
ember test --server