Skip to content

Commit efda557

Browse files
committed
中文注释
1 parent fb8d80c commit efda557

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/pkg/utils/wakeup-ping.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ export const startRepetitivePing = () => {
4848

4949
export const listenWakeupPing = (onWakeupPing: (...args: any) => any) => {
5050
chrome.storage.session.onChanged.addListener((obj) => {
51-
// consume persistentWakeup
51+
// 消耗 persistentWakeup
5252
if (typeof obj.persistentWakeup !== "undefined") {
53+
// 执行任意 callback
5354
onWakeupPing();
5455
}
5556
});
5657
channel.onmessage = (e) => {
58+
// 触发 chrome storage onChanged 使 service worker 保持活跃
5759
chrome.storage.session.set({ persistentWakeup: `${e.timeStamp}` });
5860
};
5961
};

0 commit comments

Comments
 (0)