Retain localStorage plugin
To start saving the Retain data in the localStorage
, simply inject the plugin into the Model.
var retain = require("retain");
var retainLocalStorage = require("retain-localstorage");
var Movies = retain();
Movies.use(retainLocalStorage, { name: "movies"});
- name: LocalStorage collection name.
Retain use Promises internally to transfer data between the plugins.
To create a plugin, it is necessary to implement each of the following Retain methods.
- new
- all
- set
- find
- remove
Each of theses methods must return a promise.