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,