Ember Storage
A simple but powerful way for managing data that you wish to last through a page reload. This add-on synchronizes data between browser tabs when using localStorage and it is observable.
Installation
ember install:addon ember-storage
Usage
This service is injected into all routes and components as storage
. You
may get, set, and observe data on storage
just like a regular Ember Object:
Component;
<!-- some component template --> sidebar contents Toggle Sidebar
API
prefix
(property). Set a key prefix. Handy for saving user specific device config. Defaults to 'es'.type
(property). Either 'session' or 'local'. Defaults to 'local'. Due to the waysessionStorage
works tab sync does not work if type is set to 'session'.clear
(function). Clear all data for the specified key. Defaults to the key currently set inprefix
.
Examples:
// application routeRoute;
To create an additional instance (maybe one for sessionStorage) add an initializer to your app:
// app/initializers/session-service.js; var session = Session; { container; application; application;} name: 'session-service' initialize: initialize;
Running Tests
ember test
ember test --server
For more information on using ember-cli, visit http://www.ember-cli.com/.