mirror of
https://github.com/penpot/penpot.git
synced 2025-07-29 03:27:28 +02:00
✨ Changed order of plugins initialization
This commit is contained in:
parent
c70d20f95d
commit
fb1429956a
3 changed files with 20 additions and 15 deletions
|
@ -16,15 +16,20 @@
|
|||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn init!
|
||||
(defn init-plugins-runtime!
|
||||
[]
|
||||
(->> st/stream
|
||||
(rx/filter (ptk/type? ::features/initialize))
|
||||
(rx/take 1)
|
||||
;; We need to wait to the init event to finish
|
||||
(rx/observe-on :async)
|
||||
(rx/subs!
|
||||
(fn []
|
||||
(when (features/active-feature? @st/state "plugins/runtime")
|
||||
(when-let [init-runtime (obj/get global "initPluginsRuntime")]
|
||||
(init-runtime (fn [plugin-id] (api/create-context plugin-id)))))))))
|
||||
(when-let [init-runtime (obj/get global "initPluginsRuntime")]
|
||||
(init-runtime (fn [plugin-id] (api/create-context plugin-id)))))
|
||||
|
||||
(defn initialize
|
||||
[]
|
||||
(ptk/reify ::initialize
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ stream]
|
||||
(->> stream
|
||||
(rx/filter (ptk/type? ::features/initialize))
|
||||
(rx/observe-on :async)
|
||||
(rx/filter #(features/active-feature? @st/state "plugins/runtime"))
|
||||
(rx/take 1)
|
||||
(rx/tap init-plugins-runtime!)
|
||||
(rx/ignore)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue