diff --git a/assets/javascripts/app/app.coffee b/assets/javascripts/app/app.coffee index ad53265d..8b2276d0 100644 --- a/assets/javascripts/app/app.coffee +++ b/assets/javascripts/app/app.coffee @@ -13,9 +13,9 @@ @showLoading() @el = $('._app') - @store = new Store + @localStorage = new LocalStorageStore @appCache = new app.AppCache if app.AppCache.isEnabled() - @settings = new app.Settings @store + @settings = new app.Settings @localStorage @db = new app.DB() @docs = new app.collections.Docs @@ -161,7 +161,7 @@ return reset: -> - @store.clear() + @localStorage.reset() @settings.reset() @db?.reset() @appCache?.update() diff --git a/assets/javascripts/lib/store.coffee b/assets/javascripts/lib/local_storage_store.coffee similarity index 89% rename from assets/javascripts/lib/store.coffee rename to assets/javascripts/lib/local_storage_store.coffee index c76d6f28..f4438c86 100644 --- a/assets/javascripts/lib/store.coffee +++ b/assets/javascripts/lib/local_storage_store.coffee @@ -1,4 +1,4 @@ -class @Store +class @LocalStorageStore get: (key) -> try JSON.parse localStorage.getItem(key) @@ -16,7 +16,7 @@ class @Store true catch - clear: -> + reset: -> try localStorage.clear() true diff --git a/assets/javascripts/models/doc.coffee b/assets/javascripts/models/doc.coffee index 12913021..44a6ff21 100644 --- a/assets/javascripts/models/doc.coffee +++ b/assets/javascripts/models/doc.coffee @@ -67,7 +67,7 @@ class app.models.Doc extends app.Model error: onError clearCache: -> - app.store.del @slug + app.localStorage.del @slug return _loadFromCache: (onSuccess) -> @@ -82,7 +82,7 @@ class app.models.Doc extends app.Model true _getCache: -> - return unless data = app.store.get @slug + return unless data = app.localStorage.get @slug if data[0] is @mtime return data[1] @@ -91,7 +91,7 @@ class app.models.Doc extends app.Model return _setCache: (data) -> - app.store.set @slug, [@mtime, data] + app.localStorage.set @slug, [@mtime, data] return install: (onSuccess, onError) ->