Sha256: 429bb737c1092461b3cd81686ace0ce05804056734c5702b035f2cc154cd1619
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
/** * Provides methods dealing with localStorage- and memory-store. * * Base class for Favorites and Settings. */ Ext.define("Docs.LocalStore", { storeName: '', /** * Initializes store management. * * Initializes this.store variable and loads the store if * localStorage available. */ init: function() { this.localStorage = ('localStorage' in window && window['localStorage'] !== null); this.store = Ext.getStore(this.storeName); if (this.localStorage) { this.store.load(); if (window.addEventListener) { window.addEventListener("storage", Ext.Function.bind(this.onStorageChange, this), false); } else { window.attachEvent("onstorage", Ext.Function.bind(this.onStorageChange, this)); } } }, // When records in localstorage change, reload the store. onStorageChange: function(e) { e = e || window.event; if (e.key === this.store.getProxy().id) { this.store.load(); } }, /** * Syncs the store with localStorage if possible. */ syncStore: function() { this.localStorage && this.store.sync(); } });
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jsduck-2.0.pre4 | template/app/LocalStore.js |
jsduck-2.0.pre2 | template/app/LocalStore.js |
jsduck-2.0.pre | template/app/LocalStore.js |