MCPcopy Create free account
hub / github.com/dajie111/nodeseek-userscript / checkMasterStatus

Method checkMasterStatus

Clockin.js:87–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85
86 // 检查主窗口状态
87 checkMasterStatus() {
88 const currentMaster = localStorage.getItem(STORAGE_KEYS.masterWindow);
89 const lastHeartbeat = localStorage.getItem(STORAGE_KEYS.lastHeartbeat);
90
91 if (!currentMaster || currentMaster === this.windowId ||
92 !lastHeartbeat || Date.now() - parseInt(lastHeartbeat) > 30000) {
93 this.becomeMaster();
94 }
95 }
96
97 // 监听localStorage变化
98 listenStorageChanges() {

Callers 1

startHeartbeatMethod · 0.95

Calls 1

becomeMasterMethod · 0.95

Tested by

no test coverage detected