@michengai/dsh-automation 0.1.28 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  The five most recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
6
6
 
7
+ ## 0.1.29 — 2026-09-04
8
+
9
+ - Refreshed scheduled execution records immediately when the DSH page regains focus or becomes visible, avoiding stale history when Chromium throttles background-tab timers.
10
+ - Removed page-resume listeners after the final client subscriber disconnects.
11
+
7
12
  ## 0.1.28 — 2026-09-04
8
13
 
9
14
  - Compared normalized schedules semantically so property order no longer makes an unchanged overdue one-time schedule look edited.
@@ -4,6 +4,11 @@
4
4
 
5
5
  以下记录最近发布的五个版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
6
6
 
7
+ ## 0.1.29 — 2026-09-04
8
+
9
+ - DSH 页面重新获得焦点或恢复可见时立即刷新定时任务执行记录,避免 Chromium 节流后台标签页计时器后侧栏历史停留在旧状态。
10
+ - 最后一个客户端订阅释放后同步移除页面恢复监听,避免遗留无效监听器。
11
+
7
12
  ## 0.1.28 — 2026-09-04
8
13
 
9
14
  - 改用语义方式比较规范化计划,避免属性顺序不同导致未变更的过期单次计划被误判为已编辑。
package/lib/client.js CHANGED
@@ -1386,6 +1386,7 @@ function createAutomationRuntime(rpc) {
1386
1386
  let state = { phase: "idle" };
1387
1387
  let refreshPromise;
1388
1388
  let pollTimer;
1389
+ let removePageResumeListeners = () => void 0;
1389
1390
  const listeners2 = /* @__PURE__ */ new Set();
1390
1391
  const armPoll = () => {
1391
1392
  if (pollTimer !== void 0) clearInterval(pollTimer);
@@ -1397,6 +1398,23 @@ function createAutomationRuntime(rpc) {
1397
1398
  void refresh().catch(() => void 0);
1398
1399
  }, snapshotPollIntervalMs(state.snapshot?.runs));
1399
1400
  };
1401
+ const armPageResumeListeners = () => {
1402
+ removePageResumeListeners();
1403
+ if (listeners2.size === 0) return;
1404
+ const refreshOnResume = () => {
1405
+ void refresh().catch(() => void 0);
1406
+ };
1407
+ const refreshOnVisible = () => {
1408
+ if (document.visibilityState === "visible") refreshOnResume();
1409
+ };
1410
+ if (typeof window !== "undefined") window.addEventListener("focus", refreshOnResume);
1411
+ if (typeof document !== "undefined") document.addEventListener("visibilitychange", refreshOnVisible);
1412
+ removePageResumeListeners = () => {
1413
+ if (typeof window !== "undefined") window.removeEventListener("focus", refreshOnResume);
1414
+ if (typeof document !== "undefined") document.removeEventListener("visibilitychange", refreshOnVisible);
1415
+ removePageResumeListeners = () => void 0;
1416
+ };
1417
+ };
1400
1418
  const publish = (next) => {
1401
1419
  const previousInterval = snapshotPollIntervalMs(state.snapshot?.runs);
1402
1420
  state = next;
@@ -1412,6 +1430,7 @@ function createAutomationRuntime(rpc) {
1412
1430
  if (listeners2.size > 0) void refresh().catch(() => void 0);
1413
1431
  });
1414
1432
  armPoll();
1433
+ armPageResumeListeners();
1415
1434
  }
1416
1435
  return () => {
1417
1436
  listeners2.delete(listener);
@@ -1419,6 +1438,7 @@ function createAutomationRuntime(rpc) {
1419
1438
  clearInterval(pollTimer);
1420
1439
  pollTimer = void 0;
1421
1440
  }
1441
+ if (listeners2.size === 0) removePageResumeListeners();
1422
1442
  };
1423
1443
  }
1424
1444
  };