Moved store to session store.
This commit is contained in:
parent
01678787f3
commit
21de1e8bd8
5 changed files with 16 additions and 18 deletions
|
@ -10,7 +10,7 @@ class App.DashboardActivityStream extends App.Controller
|
|||
fetch: =>
|
||||
|
||||
# use cache of first page
|
||||
cache = App.LocalStorage.get('activity_stream')
|
||||
cache = App.SessionStorage.get('activity_stream')
|
||||
if cache
|
||||
@load(cache)
|
||||
|
||||
|
@ -30,7 +30,7 @@ class App.DashboardActivityStream extends App.Controller
|
|||
|
||||
load: (data) =>
|
||||
|
||||
App.LocalStorage.set('activity_stream', data)
|
||||
App.SessionStorage.set('activity_stream', data)
|
||||
|
||||
items = data.activity_stream
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class App.DashboardRss extends App.Controller
|
|||
fetch: =>
|
||||
|
||||
# get data from cache
|
||||
cache = App.LocalStorage.get( 'dashboard_rss' )
|
||||
cache = App.SessionStorage.get('dashboard_rss')
|
||||
if cache
|
||||
cache.head = 'Heise ATOM'
|
||||
@render( cache )
|
||||
|
@ -34,7 +34,7 @@ class App.DashboardRss extends App.Controller
|
|||
message: data.message
|
||||
)
|
||||
else
|
||||
App.LocalStorage.set( 'dashboard_rss', data )
|
||||
App.SessionStorage.set('dashboard_rss', data)
|
||||
data.head = 'Heise ATOM'
|
||||
@render(data)
|
||||
error: =>
|
||||
|
|
|
@ -32,7 +32,7 @@ class App.TicketZoom extends App.Controller
|
|||
@overview_id = false
|
||||
|
||||
@key = 'ticket::' + @ticket_id
|
||||
cache = App.LocalStorage.get(@key)
|
||||
cache = App.SessionStorage.get(@key)
|
||||
if cache
|
||||
@load(cache)
|
||||
update = =>
|
||||
|
@ -168,7 +168,7 @@ class App.TicketZoom extends App.Controller
|
|||
@ticketUpdatedAtLastCall = newTicketRaw.updated_at
|
||||
|
||||
@load(data, force)
|
||||
App.LocalStorage(@key, data)
|
||||
App.SessionStorage(@key, data)
|
||||
|
||||
if !@doNotLog
|
||||
@doNotLog = 1
|
||||
|
|
|
@ -19,7 +19,7 @@ class App.WidgetTag extends App.Controller
|
|||
@render()
|
||||
return
|
||||
|
||||
@tags = App.LocalStorage.get( @cacheKey ) || []
|
||||
@tags = App.SessionStorage.get( @cacheKey ) || []
|
||||
if !_.isEmpty(@tags)
|
||||
@render()
|
||||
@delay(
|
||||
|
@ -42,7 +42,7 @@ class App.WidgetTag extends App.Controller
|
|||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
@tags = data.tags
|
||||
App.LocalStorage.set( @cacheKey, @tags )
|
||||
App.SessionStorage.set( @cacheKey, @tags )
|
||||
@render()
|
||||
)
|
||||
|
||||
|
|
|
@ -6,15 +6,15 @@ class App.SessionStorage
|
|||
_instance ?= new _storeSingleton
|
||||
_instance.set(key, value)
|
||||
|
||||
@get: (args) ->
|
||||
@get: (key) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _storeSingleton
|
||||
_instance.get(args)
|
||||
_instance.get(key)
|
||||
|
||||
@delete: (args) ->
|
||||
@delete: (key) ->
|
||||
if _instance == undefined
|
||||
_instance ?= new _storeSingleton
|
||||
_instance.delete(args)
|
||||
_instance.delete(key)
|
||||
|
||||
@clear: ->
|
||||
if _instance == undefined
|
||||
|
@ -40,7 +40,7 @@ class _storeSingleton
|
|||
catch e
|
||||
if e is QUOTA_EXCEEDED_ERR
|
||||
# do something nice to notify your users
|
||||
App.Log.error 'App.LocalStore', 'Local storage quote exceeded!'
|
||||
App.Log.error 'App.SessionStorage', 'Session storage quote exceeded!'
|
||||
|
||||
# get item
|
||||
get: (key) ->
|
||||
|
@ -58,6 +58,4 @@ class _storeSingleton
|
|||
|
||||
# return list of all keys
|
||||
list: ->
|
||||
for key of window.sessionStorage
|
||||
list.push key
|
||||
list
|
||||
window.sessionStorage
|
||||
|
|
Loading…
Reference in a new issue