Skip to content

观察器启停时机迁入 (fix #328) - #357

Merged
Teeeeeeeerry merged 1 commit into
mainfrom
fix/328-observer-timing
Aug 31, 2026
Merged

观察器启停时机迁入 (fix #328)#357
Teeeeeeeerry merged 1 commit into
mainfrom
fix/328-observer-timing

Conversation

@Teeeeeeeerry

Copy link
Copy Markdown
Owner

问题

增量补翻观察器的启停时机(翻译成功后启动、还原时停止、中止不启动)散落在内容脚本,未翻译状态下 SPA 可能自己冒出译文。

根因

启停时机决策没有迁入状态机。

修复

观察器启停迁入编排模块开关入口:整页翻译成功后启动恰好一次、还原时停止、失败与在飞还原不启动;启停经注入钩子(onObserverStart / onObserverStop)表达,调用方接线到生命周期注册表,沿用其幂等启停语义。

验证

pnpm typecheck 通过;新增 6 个启停时机单测(未触发不启动、成功启动一次、失败不启动、在飞还原不启动、重复还原停止幂等、完整周期启停各一次),pnpm test 641 个用例全部通过;pnpm build 正常。

Closes #328

增量补翻观察器的启停时机此前在内容脚本。迁入状态机:只在整页
翻译成功后启动恰好一次、还原时停止、失败与在飞还原不启动;
启停经注入钩子表达,沿用生命周期注册表幂等语义。

Co-Authored-By: zhexuancai-uts <261878103+zhexuancai-uts@users.noreply.github.com>
@Teeeeeeeerry
Teeeeeeeerry merged commit 1b2e6c6 into main Aug 31, 2026
6 checks passed
@Teeeeeeeerry
Teeeeeeeerry deleted the fix/328-observer-timing branch August 31, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

307-4 观察器启停时机迁入(父 #307)

1 participant