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
Section titled “Import”import { timer } from "@graphrefly/ts/sources";Signature
Section titled “Signature”function timer( ms: number, opts?: TimerSourceOpts,): Operator<never, number>Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
ms | number | Delay before the first tick in milliseconds. |
opts | TimerSourceOpts | Optional period and source options. |
Returns
Section titled “Returns”A source operator that emits tick counters.
Example
Section titled “Example”import { graph } from "@graphrefly/ts/graph";import { timer } from "@graphrefly/ts/sources";
const tick = graph().initNode(timer(100), []);Source
Section titled “Source”packages/ts/src/graph/sources.ts