ember-data-offline

0.2.0 • Public • Published

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 git@github.com: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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    0
    • latest

Version History

Package Sidebar

Install

npm i ember-data-offline

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • igorkur