Skip to content
PACKAGES

timer()

Timer source: one-shot (first tick then COMPLETE) or periodic ({period} → 0, 1, 2, …). sync pool + pausable:false (a timer keeps producing through PAUSE, R-pause-modes). Emits the tick counter from 0; deactivation clears the timers.

import { timer } from "@graphrefly/ts/sources";
function timer(
ms: number,
opts?: TimerSourceOpts,
): Operator<never, number>
ParameterTypeDescription
msnumberDelay before the first tick in milliseconds.
optsTimerSourceOptsOptional period and source options.

A source operator that emits tick counters.

import { graph } from "@graphrefly/ts/graph";
import { timer } from "@graphrefly/ts/sources";
const tick = graph().initNode(timer(100), []);

packages/ts/src/graph/sources.ts