mirror of
https://github.com/penpot/penpot.git
synced 2025-02-26 08:45:34 -05:00
Add better docstring for page change watcher on pages ns.
This commit is contained in:
parent
70c5a29862
commit
414b25242d
1 changed files with 12 additions and 6 deletions
|
@ -174,13 +174,19 @@
|
|||
(UpdatePage. id))
|
||||
|
||||
(defn watch-page-changes
|
||||
"A function that starts watching for `IPageUpdate`
|
||||
events emited to the global event stream and just
|
||||
reacts emiting an other event in order to perform
|
||||
the page persistence.
|
||||
|
||||
The main behavior debounces the posible emmited
|
||||
events with 1sec of delay allowing batch updates
|
||||
on fastly performed events."
|
||||
[id]
|
||||
(letfn [(on-value []
|
||||
(rs/emit! (update-page id)))]
|
||||
(as-> rs/stream $
|
||||
(rx/filter #(satisfies? IPageUpdate %) $)
|
||||
(rx/debounce 2000 $)
|
||||
(rx/on-next $ on-value))))
|
||||
(as-> rs/stream $
|
||||
(rx/filter #(satisfies? IPageUpdate %) $)
|
||||
(rx/debounce 1000 $)
|
||||
(rx/on-next $ #(rs/emit! (update-page id)))))
|
||||
|
||||
;; --- Update Page Metadata
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue