MCPcopy Index your code
hub / github.com/darkreader/darkreader / runWakeDetector

Method runWakeDetector

src/background/extension.ts:214–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

212 private static wakeInterval: number = -1;
213
214 private static runWakeDetector() {
215 const WAKE_CHECK_INTERVAL = getDuration({minutes: 1});
216 const WAKE_CHECK_INTERVAL_ERROR = getDuration({seconds: 10});
217 if (this.wakeInterval >= 0) {
218 clearInterval(this.wakeInterval);
219 }
220
221 let lastRun = Date.now();
222 this.wakeInterval = setInterval(() => {
223 const now = Date.now();
224 if (now - lastRun > WAKE_CHECK_INTERVAL + WAKE_CHECK_INTERVAL_ERROR) {
225 Extension.handleAutomationCheck();
226 }
227 lastRun = now;
228 }, WAKE_CHECK_INTERVAL);
229 }
230
231 static async start(): Promise<void> {
232 Extension.init();

Callers 1

startMethod · 0.80

Calls 1

getDurationFunction · 0.90

Tested by

no test coverage detected