Skip to content
PACKAGES

fromTimer()

Create a timer source with the fromTimer source factory.

import { fromTimer } from "@graphrefly/ts/sources";
function fromTimer(
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 { fromTimer } from "@graphrefly/ts/sources";
const tick = graph().initNode(fromTimer(100), []);
  • Factory name: This preserves the real fromTimer factory name in describe().

packages/ts/src/graph/sources.ts