GraphReFlyTS

API Reference

switchMap()

switchMap: project each source value to an inner; on a new source value, CANCEL the in-flight inner (its source _deactivates — abortInFlight) and switch to the new one. Only the current inner's emissions are forwarded.

Import

import { switchMap } from "@graphrefly/ts/operators";

Signature

function switchMap(project: Project<TIn, TOut>): Operator<TIn, TOut>

Parameters

ParameterTypeDescription
projectProject<TIn, TOut>project value used by the helper.

Returns

A Operator<TIn, TOut> value.

Example

import { switchMap } from "@graphrefly/ts/operators";

Source

packages/ts/src/graph/higher-order.ts