From ba26fd512a4bd18932c6ed87a05b22a227a44c39 Mon Sep 17 00:00:00 2001 From: ypshidifu Date: Tue, 22 Sep 2026 21:23:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8E=A2=E6=B5=8B=E7=89=88?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=EF=BC=9A=E6=B7=BB=E5=8A=A0=E5=BB=B6=E6=97=B6?= =?UTF-8?q?=E9=81=BF=E5=85=8D=20toast=20=E8=A2=AB=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tui-plugins/oc-session-all.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tui-plugins/oc-session-all.js b/tui-plugins/oc-session-all.js index 1af4993..f71c3c4 100644 --- a/tui-plugins/oc-session-all.js +++ b/tui-plugins/oc-session-all.js @@ -22,10 +22,21 @@ function log(msg) { console.log(msg) } +// 延时函数 +function delay(ms) { + return new Promise(resolve => setTimeout(resolve, ms)) +} + export default Plugin.define({ id: "oc-session-all", - setup(context) { - log("[oc-session-all] v2 Plugin loaded! Attempting keymap.layer registration...") + async setup(context) { + log("[oc-session-all] v2 Plugin loaded! Waiting 3 seconds before toast...") + + // 先写入测试日志,确保 fs 可用 + log("[oc-session-all] FS test: log file created successfully") + + // 延时 3 秒,避免 toast 被覆盖 + await delay(3000) // ── 探测 context.keymap 结构 ────────────────────────────────────── const report = [] @@ -98,6 +109,9 @@ export default Plugin.define({ const msg = report.join(" | ") log("[oc-session-all] KEYMAP PROBE: " + msg) + + // 再次延时,确保 toast 不被覆盖 + await delay(1000) try { context.ui.toast.show({ message: "Keymap probe: " + msg,