Runs the worker's periodic tasks. Every task the core hands a scheduler catches its own
errors, so a tick can be fired and forgotten — the built-in fallback is a plain setInterval
(intervalScheduler in src/runtime.ts). The returned stop function halts future ticks; it
does not cancel a tick already in flight.
Example
// A test scheduler that fires on demand instead of on a timer. constticks: Array<() =>Promise<void>> = []; constscheduler: Scheduler = { every: (_ms, task) => { ticks.push(task); return () =>voidticks.splice(ticks.indexOf(task), 1); }, }; awaitticks[0]!(); // drive one worker tick by hand
Runs the worker's periodic tasks. Every task the core hands a scheduler catches its own errors, so a tick can be fired and forgotten — the built-in fallback is a plain
setInterval(intervalSchedulerin src/runtime.ts). The returned stop function halts future ticks; it does not cancel a tick already in flight.Example