docs: clarify task example ownership and failure boundaries

This commit is contained in:
2026-11-12 21:22:00 +08:00
parent 40b43ac3c3
commit 94e0f96e4a
6 changed files with 11 additions and 4 deletions
+2 -1
View File
@@ -12,7 +12,8 @@ class Actions {
// 每次启动 1500ms 的 load 定时器;相同 owner/key 只有最新任务继续等待。
// 三个按钮的 click 事件路由调用 schedule,event 为事件参数;方法内部不读取它,只创建延时任务。
function schedule(self: Actions, event: Event): Unit {
// 返回句柄未存入字段也不立即取消,调度器继续维护任务;同一 owner/load 新任务替换旧等待。
// 返回句柄未存入字段也不立即取消:owner 的任务字典强持有 Task,调度器本身仅保存弱索引。
// 此处 owner 仍由全局/业务字段保留;同一 owner/load 新任务替换旧等待,不靠局部 Task 变量维持资格。
ui.after(self.owner, "load", 1500, self.complete)
}
}