ember-seamless-immutable

0.1.1 • Public • Published

Ember Seamless Immutable

Build Status npm version Ember Observer Score

"Immutable data structures which are backwards-compatible with normal Arrays and Objects" provided by the excellent Seamless Immutable library, wrapped and adapted for Ember.

⚠️ Experimental. A noop function is defined on all objects made immutable to circumvent Ember defining meta properties on them.

⚠️ Array prototype extension incompatiblity. This add-on is incompatible with the Ember array prototype extension. For instructions on disabling prototype extensions consult the Ember guide.

Why Addon?

  • 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

Installation

ember install ember-seamless-immutable

Usage

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.

Helper

{{contact-detail contact=(immutable contact)}}

An immutable contact object will be passed in to the component.

Running Tests

  • ember test
  • ember test --server

Package Sidebar

Install

npm i ember-seamless-immutable

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • cyk