mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 06:02:32 -05:00
💄 Update run-store helper
This commit is contained in:
parent
bde1cd3f5f
commit
22f3dba842
1 changed files with 11 additions and 7 deletions
|
@ -42,21 +42,25 @@
|
|||
([store done events completed-cb]
|
||||
(run-store store done events completed-cb nil))
|
||||
([store done events completed-cb stopper]
|
||||
(let [stream (ptk/input-stream store)]
|
||||
(let [stream (ptk/input-stream store)
|
||||
stopper-s (if (fn? stopper)
|
||||
(stopper stream)
|
||||
(rx/filter #(= :the/end %) stream))]
|
||||
|
||||
(->> stream
|
||||
(rx/take-until (if stopper
|
||||
(stopper stream)
|
||||
(rx/filter #(= :the/end %) stream)))
|
||||
(rx/take-until stopper-s)
|
||||
(rx/last)
|
||||
(rx/tap (fn []
|
||||
(rx/tap (fn [_]
|
||||
(completed-cb @store)))
|
||||
(rx/subs! (fn [_] (done))
|
||||
(fn [cause]
|
||||
(js/console.log "[error]:" cause))
|
||||
(fn [_]
|
||||
(js/console.log "[complete]"))))
|
||||
(doall (for [event events]
|
||||
(ptk/emit! store event)))
|
||||
|
||||
(doseq [event events]
|
||||
(ptk/emit! store event))
|
||||
|
||||
(ptk/emit! store :the/end))))
|
||||
|
||||
(defn get-file-from-store
|
||||
|
|
Loading…
Add table
Reference in a new issue