aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/observable/local-storage.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-01-25 11:47:00 +0800
committerkumavis <aaron@kumavis.me>2017-01-25 11:47:00 +0800
commit76ce348a04b83693eda0e8a40f9888c1f5fe7ef5 (patch)
treed31aeddd6752f03ca1c65569e4fadf203ca8692f /app/scripts/lib/observable/local-storage.js
parenta06ee454045b9087160d3af1c081556662bbd3cb (diff)
downloadtangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.tar.gz
tangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.tar.zst
tangerine-wallet-browser-76ce348a04b83693eda0e8a40f9888c1f5fe7ef5.zip
obs-store - use published module
Diffstat (limited to 'app/scripts/lib/observable/local-storage.js')
-rw-r--r--app/scripts/lib/observable/local-storage.js37
1 files changed, 0 insertions, 37 deletions
diff --git a/app/scripts/lib/observable/local-storage.js b/app/scripts/lib/observable/local-storage.js
deleted file mode 100644
index 6ed3860f6..000000000
--- a/app/scripts/lib/observable/local-storage.js
+++ /dev/null
@@ -1,37 +0,0 @@
-const ObservableStore = require('./index')
-
-//
-// LocalStorageStore
-//
-// uses localStorage instead of a cache
-//
-
-class LocalStorageStore extends ObservableStore {
-
- constructor (opts) {
- super()
- delete this._state
-
- this._opts = opts || {}
- if (!this._opts.storageKey) {
- throw new Error('LocalStorageStore - no "storageKey" specified')
- }
- this._storageKey = this._opts.storageKey
- }
-
- get() {
- try {
- return JSON.parse(global.localStorage[this._storageKey])
- } catch (err) {
- return undefined
- }
- }
-
- _put(newState) {
- global.localStorage[this._storageKey] = JSON.stringify(newState)
- this.emit('update', newState)
- }
-
-}
-
-module.exports = LocalStorageStore