MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / ensureAutoRunTimerAlarm

Function ensureAutoRunTimerAlarm

background.js:3861–3873  ·  view source on GitHub ↗
(fireAt)

Source from the content-addressed store, hash-verified

3859}
3860
3861async function ensureAutoRunTimerAlarm(fireAt) {
3862 if (!Number.isFinite(fireAt) || fireAt <= Date.now()) {
3863 return false;
3864 }
3865
3866 const existingAlarm = await chrome.alarms.get(AUTO_RUN_TIMER_ALARM_NAME);
3867 if (!existingAlarm || Math.abs((existingAlarm.scheduledTime || 0) - fireAt) > 1000) {
3868 await chrome.alarms.clear(AUTO_RUN_TIMER_ALARM_NAME);
3869 await chrome.alarms.create(AUTO_RUN_TIMER_ALARM_NAME, { when: fireAt });
3870 }
3871
3872 return true;
3873}
3874
3875async function clearAutoRunTimerAlarm() {
3876 await chrome.alarms.clear(AUTO_RUN_TIMER_ALARM_NAME);

Callers 2

persistAutoRunTimerPlanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected