From 85d274a528c008207c01fdf5dda04494ee066f2c Mon Sep 17 00:00:00 2001 From: "chris (daiyi)" Date: Thu, 24 Aug 2017 12:25:34 +0200 Subject: [PATCH] Override clojure get in localstorage ns --- src/day8/re_frame/trace.cljs | 2 +- src/day8/re_frame/trace/localstorage.cljs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/day8/re_frame/trace.cljs b/src/day8/re_frame/trace.cljs index ae37eb2..896e274 100644 --- a/src/day8/re_frame/trace.cljs +++ b/src/day8/re_frame/trace.cljs @@ -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) diff --git a/src/day8/re_frame/trace/localstorage.cljs b/src/day8/re_frame/trace/localstorage.cljs index cee9cb8..df6cf08 100644 --- a/src/day8/re_frame/trace/localstorage.cljs +++ b/src/day8/re_frame/trace/localstorage.cljs @@ -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)))