Rename Store → LocalStorageStore

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

@ -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()

@ -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

@ -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) ->

Loading…
Cancel
Save