@pwngh/economy-lab
    Preparing search index...

    Interface Scheduler

    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.

    // A test scheduler that fires on demand instead of on a timer.
    const ticks: Array<() => Promise<void>> = [];
    const scheduler: Scheduler = {
    every: (_ms, task) => {
    ticks.push(task);
    return () => void ticks.splice(ticks.indexOf(task), 1);
    },
    };
    await ticks[0]!(); // drive one worker tick by hand
    interface Scheduler {
        every(
            ms: number,
            task: () => Promise<void>,
            options?: CallOptions,
        ): () => void;
    }
    Index
    • Runs task every ms milliseconds; the returned function stops the loop.

      Parameters

      • ms: number
      • task: () => Promise<void>
      • Optionaloptions: CallOptions

      Returns () => void