mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 16:21:57 -05:00
🐛 Fix problem when initializing plugin
This commit is contained in:
parent
4b05ee35b8
commit
519b2d7f04
1 changed files with 14 additions and 5 deletions
|
@ -11,11 +11,20 @@
|
|||
[app.main.store :as st]
|
||||
[app.plugins.api :as api]
|
||||
[app.util.globals :refer [global]]
|
||||
[app.util.object :as obj]))
|
||||
[app.util.object :as obj]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn init!
|
||||
[]
|
||||
(when (features/active-feature? @st/state "plugins/runtime")
|
||||
(when-let [init-runtime (obj/get global "initPluginsRuntime")]
|
||||
(let [context (api/create-context)]
|
||||
(init-runtime context)))))
|
||||
(->> 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")]
|
||||
(let [context (api/create-context)]
|
||||
(init-runtime context))))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue