0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

📎 Add minor change on how promise is created from observable

This commit is contained in:
Andrey Antukh 2024-06-26 11:23:28 +02:00
parent 44b6d1a516
commit 4faf9bbff1

View file

@ -17,7 +17,8 @@
[app.util.zip :as uz]
[app.worker.export :as e]
[beicon.v2.core :as rx]
[cuerdas.core :as str]))
[cuerdas.core :as str]
[promesa.core :as p]))
(defn parse-data [data]
(as-> data $
@ -261,14 +262,16 @@
(uuid/next))
(export [_]
(js/Promise.
(fn [resolve _reject]
(-> (export-file file)
(rx/subscribe
(fn [value]
(when (not (contains? value :type))
(let [[_ export-blob] value]
(resolve export-blob))))))))))
(p/create
(fn [resolve reject]
(->> (export-file file)
(rx/take 1)
(rx/subs!
(fn [value]
(when (not (contains? value :type))
(let [[_ export-blob] value]
(resolve export-blob))))
reject))))))
(defn create-file-export [^string name]
(binding [cfeat/*current* cfeat/default-features]