mirror of
https://github.com/penpot/penpot.git
synced 2025-03-15 17:21:17 -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.main.store :as st]
|
||||||
[app.plugins.api :as api]
|
[app.plugins.api :as api]
|
||||||
[app.util.globals :refer [global]]
|
[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!
|
(defn init!
|
||||||
[]
|
[]
|
||||||
|
(->> 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 (features/active-feature? @st/state "plugins/runtime")
|
||||||
(when-let [init-runtime (obj/get global "initPluginsRuntime")]
|
(when-let [init-runtime (obj/get global "initPluginsRuntime")]
|
||||||
(let [context (api/create-context)]
|
(let [context (api/create-context)]
|
||||||
(init-runtime context)))))
|
(init-runtime context))))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue