npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

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

install

npm i ember-data-offline

Downloadsweekly downloads

5

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability