mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
360 B
24 lines
360 B
9 years ago
|
class @LocalStorageStore
|
||
11 years ago
|
get: (key) ->
|
||
|
try
|
||
|
JSON.parse localStorage.getItem(key)
|
||
|
catch
|
||
|
|
||
|
set: (key, value) ->
|
||
|
try
|
||
|
localStorage.setItem(key, JSON.stringify(value))
|
||
|
true
|
||
|
catch
|
||
|
|
||
|
del: (key) ->
|
||
|
try
|
||
|
localStorage.removeItem(key)
|
||
|
true
|
||
|
catch
|
||
|
|
||
9 years ago
|
reset: ->
|
||
11 years ago
|
try
|
||
|
localStorage.clear()
|
||
|
true
|
||
|
catch
|