diff --git a/src/main.ts b/src/main.ts index 133ee14..278f7b1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -211,7 +211,8 @@ window.onload = function () { }) // 向父窗口暴露:显示保存状态(文本、颜色、延时可选) - ;(window as any).showSaveStatus = (text: string, color?: string, delay?: number) => { + const winAny = window as any + winAny.showSaveStatus = (text: string, color?: string, delay?: number) => { try { const indicator = document.getElementById('save-status-indicator') as HTMLDivElement | null if (!indicator) return @@ -221,11 +222,11 @@ window.onload = function () { indicator.style.display = 'block' // 清理之前的隐藏计时器 const key = '__save_status_timer__' - const prev = (window as any)[key] + const prev = winAny[key] if (prev) { window.clearTimeout(prev) } - ;(window as any)[key] = window.setTimeout(() => { + winAny[key] = window.setTimeout(() => { indicator.style.display = 'none' }, duration) } catch (err) {