ember-tracked-storage-polyfill

Polyfill of the Ember/Glimmer Tracked Storage primitive

Usage no npm install needed!

<script type="module">
  import emberTrackedStoragePolyfill from 'https://cdn.skypack.dev/ember-tracked-storage-polyfill';
</script>

README

ember-tracked-storage-polyfill

Polyfills the tracked storage primitive from Ember/Glimmer.

import { createStorage, getValue, setValue } from 'ember-tracked-storage-polyfill';

let storage = createStorage(true);

getValue(storage); // true

setValue(storage, false);

getValue(storage); // false

See the RFC for more details. Imports should be from the polyfill itself, not the path from Ember in the RFC:

// right
import { createStorage, getValue, setValue } from 'ember-tracked-storage-polyfill';

// wrong
import { createStorage, getValue, setValue } from '@glimmer/tracking/primitives/storage';

The extra complexity required to polyfill the import path as it will be in Ember itself is not compatible with Embroider, and generally not worth it. This import path will begin re-exporting from Ember as soon as the real version is available, making the transition seamless.

Compatibility

  • Ember.js v3.15 or above
  • Ember CLI v3.20 or above
  • Node.js v10 or above

Installation

ember install ember-tracked-storage-polyfill

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.