Create localstorage helper
This commit is contained in:
parent
a989ad0580
commit
09fdd66e71
|
@ -0,0 +1,16 @@
|
||||||
|
(ns day8.re-frame.trace.localstorage
|
||||||
|
(:require [goog.storage.Storage :as Storage]
|
||||||
|
[goog.storage.mechanism.HTML5LocalStorage :as html5localstore]))
|
||||||
|
|
||||||
|
(defn- storage []
|
||||||
|
(let [mech (goog.storage.mechanism.HTML5LocalStorage.)
|
||||||
|
store (goog.storage.Storage. mech)]
|
||||||
|
store))
|
||||||
|
|
||||||
|
(defn get! [key]
|
||||||
|
(let [store (storage)]
|
||||||
|
(.get store key)))
|
||||||
|
|
||||||
|
(defn set! [key val]
|
||||||
|
(let [store (storage)]
|
||||||
|
(.set store key val)))
|
|
@ -2,6 +2,7 @@
|
||||||
(:require [day8.re-frame.trace.subvis :as subvis]
|
(:require [day8.re-frame.trace.subvis :as subvis]
|
||||||
[day8.re-frame.trace.styles :as styles]
|
[day8.re-frame.trace.styles :as styles]
|
||||||
[day8.re-frame.trace.components :as components]
|
[day8.re-frame.trace.components :as components]
|
||||||
|
[day8.re-frame.trace.localstorage :as localstorage]
|
||||||
[re-frame.trace :as trace :include-macros true]
|
[re-frame.trace :as trace :include-macros true]
|
||||||
[cljs.pprint :as pprint]
|
[cljs.pprint :as pprint]
|
||||||
[clojure.string :as str]
|
[clojure.string :as str]
|
||||||
|
|
Loading…
Reference in New Issue