X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/3789b528d8dd8aad4558e38e22d775bcab1cbd36..6746dc89c47ed01b165cc1152533605f97eb8e8d:/docs/app/LocalStore.js diff --git a/docs/app/LocalStore.js b/docs/app/LocalStore.js new file mode 100644 index 00000000..7bad266f --- /dev/null +++ b/docs/app/LocalStore.js @@ -0,0 +1,28 @@ +/** + * Provides methods dealing with localStorage- and memory-store. + * + * Base class for History and Favorites. + */ +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); + this.localStorage && this.store.load(); + }, + + /** + * Syncs the store with localStorage if possible. + */ + syncStore: function() { + this.localStorage && this.store.sync(); + } + +});