enhance(plugin): add load events

This commit is contained in:
charlie
2024-12-28 10:50:08 +08:00
parent d3b68f1ff7
commit 23166186b0
2 changed files with 11 additions and 3 deletions

View File

@@ -767,7 +767,7 @@
(let [text (state/sub :plugin/indicator-text)]
(when-not (= text "END")
[:div.flex.align-items.justify-center.h-screen.w-full.preboot-loading
[:span.flex.items-center.justify-center.w-60.flex-col
[:span.flex.items-center.justify-center.flex-col
[:small.scale-250.opacity-70.mb-10.animate-pulse (svg/logo)]
[:small.block.text-sm.relative.opacity-50 {:style {:right "-8px"}} text]]])))
@@ -779,8 +779,6 @@
(rum/mount
(lsp-indicator) el))
(state/set-state! :plugin/indicator-text "LOADING")
(-> (p/let [root (init-ls-dotdir-root)
_ (.setupPluginCore js/LSPlugin (bean/->js {:localUserConfigRoot root :dotConfigRoot root}))
@@ -799,6 +797,10 @@
(register-plugin
(bean/->clj (.parse js/JSON (.stringify js/JSON pl))))))
(.on "beforeload"
(fn [^js pl]
(state/set-state! :plugin/indicator-text (util/format "Load plugin: %s..." (.-id pl)))))
(.on "reloaded"
(fn [^js pl]
(register-plugin