mirror of
https://github.com/penpot/penpot.git
synced 2025-05-17 17:36:12 +02: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
|
(ns uxbox.util.storage
|
||||||
(:require [uxbox.util.transit :as t]))
|
(:require [uxbox.util.transit :as t]))
|
||||||
|
|
||||||
|
(defn- ^boolean is-worker?
|
||||||
|
[]
|
||||||
|
(or (= *target* "nodejs")
|
||||||
|
(not (exists? js/window))))
|
||||||
|
|
||||||
(defn- persist
|
(defn- persist
|
||||||
[alias value]
|
[alias value]
|
||||||
(when-not (or (= *target* "nodejs")
|
(when-not (is-worker?)
|
||||||
(not (exists? js/window)))
|
|
||||||
(let [key (name alias)
|
(let [key (name alias)
|
||||||
value (t/encode value)]
|
value (t/encode value)]
|
||||||
(.setItem js/localStorage key value))))
|
(.setItem js/localStorage key value))))
|
||||||
|
|
||||||
(defn- load
|
(defn- load
|
||||||
[alias]
|
[alias]
|
||||||
(when-not (or (= *target* "nodejs")
|
(when-not (is-worker?)
|
||||||
(not (exists? js/window)))
|
|
||||||
(let [data (.getItem js/localStorage (name alias))]
|
(let [data (.getItem js/localStorage (name alias))]
|
||||||
(try
|
(try
|
||||||
(t/decode data)
|
(t/decode data)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue