diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-05-26 02:36:07 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-05-26 03:03:18 +0800 |
commit | e575323c6013b89873b698a7f34da135a4b2c51f (patch) | |
tree | 43ff4bed7fdf007936fc1ba3ee3d113f884dd842 /packages/website/ts/local_storage | |
parent | 809ac3340cb477d4b46e24d4bad028568beeec06 (diff) | |
download | dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.tar.gz dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.tar.zst dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.zip |
Auto-show onboarding flow on first page view
Diffstat (limited to 'packages/website/ts/local_storage')
-rw-r--r-- | packages/website/ts/local_storage/local_storage.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/website/ts/local_storage/local_storage.ts b/packages/website/ts/local_storage/local_storage.ts index 20a533a91..569e262fc 100644 --- a/packages/website/ts/local_storage/local_storage.ts +++ b/packages/website/ts/local_storage/local_storage.ts @@ -26,6 +26,20 @@ export const localStorage = { } window.localStorage.removeItem(key); }, + getObject(key: string): object { + const item = localStorage.getItemIfExists(key); + if (item) { + try { + return JSON.parse(item); + } catch (err) { + return undefined; + } + } + return undefined; + }, + setObject(key: string, value: object): void { + localStorage.setItem(key, JSON.stringify(value)); + }, getAllKeys(): string[] { if (!this.doesExist) { return []; |