Ember-data-offline is an addon that extends ember-data to work in offline mode.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
addon
app
blueprints
config
tests
vendor
.bowerrc
.editorconfig
.ember-cli
.gitignore
.jshintrc
.npmignore
.travis.yml
.watchmanconfig
LICENSE.md
README.md
bower.json
ember-cli-build.js
index.js
package.json
testem.json
yuidoc.json

README.md

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