Rename Store → LocalStorageStore

pull/427/head
Thibaut Courouble 9 years ago
parent 7a1591f68c
commit 66f170c01d

@ -13,9 +13,9 @@
@showLoading() @showLoading()
@el = $('._app') @el = $('._app')
@store = new Store @localStorage = new LocalStorageStore
@appCache = new app.AppCache if app.AppCache.isEnabled() @appCache = new app.AppCache if app.AppCache.isEnabled()
@settings = new app.Settings @store @settings = new app.Settings @localStorage
@db = new app.DB() @db = new app.DB()
@docs = new app.collections.Docs @docs = new app.collections.Docs
@ -161,7 +161,7 @@
return return
reset: -> reset: ->
@store.clear() @localStorage.reset()
@settings.reset() @settings.reset()
@db?.reset() @db?.reset()
@appCache?.update() @appCache?.update()

@ -1,4 +1,4 @@
class @Store class @LocalStorageStore
get: (key) -> get: (key) ->
try try
JSON.parse localStorage.getItem(key) JSON.parse localStorage.getItem(key)
@ -16,7 +16,7 @@ class @Store
true true
catch catch
clear: -> reset: ->
try try
localStorage.clear() localStorage.clear()
true true

@ -67,7 +67,7 @@ class app.models.Doc extends app.Model
error: onError error: onError
clearCache: -> clearCache: ->
app.store.del @slug app.localStorage.del @slug
return return
_loadFromCache: (onSuccess) -> _loadFromCache: (onSuccess) ->
@ -82,7 +82,7 @@ class app.models.Doc extends app.Model
true true
_getCache: -> _getCache: ->
return unless data = app.store.get @slug return unless data = app.localStorage.get @slug
if data[0] is @mtime if data[0] is @mtime
return data[1] return data[1]
@ -91,7 +91,7 @@ class app.models.Doc extends app.Model
return return
_setCache: (data) -> _setCache: (data) ->
app.store.set @slug, [@mtime, data] app.localStorage.set @slug, [@mtime, data]
return return
install: (onSuccess, onError) -> install: (onSuccess, onError) ->

Loading…
Cancel
Save