improve(plugin): plugin perf tips for initial loader

This commit is contained in:
charlie
2022-08-24 15:51:48 +08:00
committed by Tienson Qin
parent 62c091840a
commit 04e04e4005
9 changed files with 99 additions and 7 deletions

View File

@@ -665,7 +665,24 @@
(let [id (keyword id)]
(when (and settings
(contains? (:plugin/installed-plugins @state/state) id))
(update-plugin-settings-state id (bean/->clj settings)))))))
(update-plugin-settings-state id (bean/->clj settings))))))
(.on "ready" (fn [^js perf-table]
(when-let [plugins (and perf-table (.entries perf-table))]
(->> plugins
(keep
(fn [[_k ^js v]]
(when-let [end (and (some-> v (.-o) (.-disabled) (not))
(.-e v))]
(when (and (number? end)
;; valid end time
(> end 0)
;; greater than 3s
(> (- end (.-s v)) 3000))
v))))
((fn [perfs]
(doseq [perf perfs]
(state/pub-event! [:plugin/loader-perf-tip (bean/->clj perf)])))))))))
default-plugins (get-user-default-plugins)