diff options
author | Dan Miller <danjm.com@gmail.com> | 2018-10-24 14:31:45 +0800 |
---|---|---|
committer | Dan Miller <danjm.com@gmail.com> | 2018-12-04 11:36:22 +0800 |
commit | 79de7a45ae8da7a9578ce394594e700886a640eb (patch) | |
tree | 2305ac70fc7bd7eee28a792b834186b302351a3e /ui/lib | |
parent | e3f015c88f30fb4243ebbb3d2f109be8f3d68196 (diff) | |
download | tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.tar tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.tar.gz tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.tar.bz2 tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.tar.lz tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.tar.xz tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.tar.zst tangerine-wallet-browser-79de7a45ae8da7a9578ce394594e700886a640eb.zip |
Connect gas price chart to gas station api.
Diffstat (limited to 'ui/lib')
-rw-r--r-- | ui/lib/local-storage-helpers.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/lib/local-storage-helpers.js b/ui/lib/local-storage-helpers.js new file mode 100644 index 000000000..287586c49 --- /dev/null +++ b/ui/lib/local-storage-helpers.js @@ -0,0 +1,20 @@ +export function loadLocalStorageData (itemKey) { + try { + const serializedData = localStorage.getItem(itemKey) + if (serializedData === null) { + return undefined + } + return JSON.parse(serializedData) + } catch (err) { + return undefined + } +} + +export function saveLocalStorageData (data, itemKey) { + try { + const serializedData = JSON.stringify(data) + localStorage.setItem(itemKey, serializedData) + } catch (err) { + console.warn(err) + } +} |