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

Method setupCleanup

Clockin.js:222–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

220
221 // 页面卸载清理
222 setupCleanup() {
223 const cleanup = () => {
224 // 清理所有定时器
225 this.timers.forEach(timer => {
226 clearInterval(timer);
227 clearTimeout(timer);
228 });
229 this.timers = [];
230
231 // 清理签到定时器
232 if (this.nextSignTimer) {
233 clearTimeout(this.nextSignTimer);
234 this.nextSignTimer = null;
235 }
236
237 if (this.isMaster) {
238 localStorage.removeItem(STORAGE_KEYS.masterWindow);
239 localStorage.removeItem(STORAGE_KEYS.lastHeartbeat);
240 }
241 };
242
243 window.addEventListener('beforeunload', cleanup);
244 window.addEventListener('pagehide', cleanup);
245 }
246
247 // 添加操作日志
248 addLog(message) {

Callers 1

initMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected