Override clojure get in localstorage ns
This commit is contained in:
parent
21406bb3b4
commit
85d274a528
|
@ -188,7 +188,7 @@
|
|||
|
||||
(defn render-trace-panel []
|
||||
(let [filter-input (r/atom "")
|
||||
filter-items (r/atom (or (localstorage/load "filter-items")
|
||||
filter-items (r/atom (or (localstorage/get "filter-items")
|
||||
[]))
|
||||
filter-type (r/atom :contains)
|
||||
input-error (r/atom false)
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
(ns day8.re-frame.trace.localstorage
|
||||
(:require [goog.storage.Storage :as Storage]
|
||||
[goog.storage.mechanism.HTML5LocalStorage :as html5localstore]
|
||||
[cljs.reader :as reader]))
|
||||
[cljs.reader :as reader])
|
||||
(:refer-clojure :exclude [get]))
|
||||
|
||||
(def mech (goog.storage.mechanism.HTML5LocalStorage.))
|
||||
|
||||
(defn- storage []
|
||||
(goog.storage.Storage. mech))
|
||||
|
||||
(defn load [key]
|
||||
(defn get [key]
|
||||
(when-let [value (.get (storage) key)]
|
||||
(cljs.reader/read-string value)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue