5 Matching Annotations
- Dec 2020
-
programmingwithmosh.com programmingwithmosh.com
-
sessionStorage (a storage that persists for duration of the session, comparable to session cookies)
-
localStorage (a persistent storage, which can be compared to persistent cookies)
-
-
stackoverflow.com stackoverflow.com
-
class Session extends Map { set(id, value) { if (typeof value === 'object') value = JSON.stringify(value); sessionStorage.setItem(id, value); } get(id) { const value = sessionStorage.getItem(id); try { return JSON.parse(value); } catch (e) { return value; } } }
-
-
developer.mozilla.org developer.mozilla.org
-
The Web Storage API provides mechanisms by which browsers can store key/value pairs, in a much more intuitive fashion than using cookies.
-
-
www.iditect.com www.iditect.com
-
const store = observable({ players: [ "Player 1", "Player 2", ], // ... }) reaction(() => JSON.stringify(store), json => { localStorage.setItem('store',json); }, { delay: 500, }); let json = localStorage.getItem('store'); if(json) { Object.assign(store, JSON.parse(json)); }
-