-
Notifications
You must be signed in to change notification settings - Fork 1
LocalStore
podefr edited this page Apr 4, 2012
·
1 revision
The LocalStore is an Emily Store that can be synchronized with a localStorage for data persistence.
###Creating a LocalStore
// A LocalStore is a subtype of an Emily Store, following liskov substitution princple.
var localStore = new LocalStore(["default", "values"]);
###Saving data in the browser
It adds a new sync function.
// On sync, values already existing in localStorage.store will be mixed in the Store
// And on changes, localStorage will be updated
localStore.sync("store");
Notice though that if localStorage is modified from somewhere else, the Store won't be updated. There's no notification on localStorage changes.