Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
"Return a component that is an atom backed by local storage (if supported).
`default` is used to initialise the atom if it is not already in
local storage. The ILifecycle protocol is not implemented."
{:sig [[schema/Any schema/Keyword :- (protocol IDeref)]]}
[default key]
(let [app-state-atom (atom default)]
(if js/localStorage
(local-storage app-state-atom key)
app-state-atom)))
{:sig [[(protocol IDeref) schema/Keyword :- (protocol IDeref)]]}
[default-atom key]
(if js/localStorage
(local-storage default-atom key)
default-atom))

;; define a value reference type that is serialised as nil
(deftype Filtered [v]
Expand Down