mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
💄 Cosmetic fixes on storage ns.
This commit is contained in:
parent
fac14be90a
commit
d37a2766db
1 changed files with 7 additions and 4 deletions
|
@ -7,18 +7,21 @@
|
|||
(ns uxbox.util.storage
|
||||
(:require [uxbox.util.transit :as t]))
|
||||
|
||||
(defn- ^boolean is-worker?
|
||||
[]
|
||||
(or (= *target* "nodejs")
|
||||
(not (exists? js/window))))
|
||||
|
||||
(defn- persist
|
||||
[alias value]
|
||||
(when-not (or (= *target* "nodejs")
|
||||
(not (exists? js/window)))
|
||||
(when-not (is-worker?)
|
||||
(let [key (name alias)
|
||||
value (t/encode value)]
|
||||
(.setItem js/localStorage key value))))
|
||||
|
||||
(defn- load
|
||||
[alias]
|
||||
(when-not (or (= *target* "nodejs")
|
||||
(not (exists? js/window)))
|
||||
(when-not (is-worker?)
|
||||
(let [data (.getItem js/localStorage (name alias))]
|
||||
(try
|
||||
(t/decode data)
|
||||
|
|
Loading…
Reference in a new issue