Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 1.79 KB

README.md

File metadata and controls

71 lines (47 loc) · 1.79 KB

Ember-data-offline

Build Status npm version Ember Observer Score Stories in Ready

Ember-data-offline is an addon that extends ember-data to work in offline mode.

It caches records in the local storage (IndexedDB or equivalents).

Installation

ember install ember-data-offline

Setup

First, define your application adapter with offline support:

//app/adapters/application.js

import baseAdapter from 'ember-data-offline/adapters/base';

export default baseAdapter.extend({
  offlineNamespace: 'foo'//optional
});

Then define a model and a serializer for it:

//app/serializers/application.js

import DS from 'ember-data';

export default DS.RESTSerializer.extend({
});

If your primary key is different from 'id', you have to specify it in the adapter and serializer:

// in adapter:

export default appAdapter.extend({
  serializerPrimaryKey: '_id',
});

For more information, please, take look at dummy app.

Details

All syncornizations between local storage and backend are queued and performed sequentially.

Contribution

  1. fork repo
  2. git clone [email protected]:your-github/ember-data-offline.git
  3. npm i && bower install
  4. add your feature
  5. cover with tests
  6. send PR!

License

[Licensed under MIT license] 1