GraphReFlyTS

API Reference

firstValueFrom()

Resolve the first DATA from a Node as a Promise.

Import

import { firstValueFrom } from "@graphrefly/ts/sources";

Signature

function firstValueFrom(source: Node<T>): Promise<T>

Parameters

ParameterTypeDescription
sourceNode<T>Node to subscribe to.

Returns

A Promise for the first DATA value, or a rejection on ERROR/early completion.

Example

import { graph } from "@graphrefly/ts/graph";
import { firstValueFrom } from "@graphrefly/ts/sources";

const g = graph();
await firstValueFrom(g.state(1));

Remarks

  • Host-boundary escape hatch only. Do not call it from reactive node bodies; use graph deps/messages there so the topology remains declarative and inspectable.

Source

packages/ts/src/graph/sources.ts