acquireChannelEffect (projections/channel-effect.ts)

langgraphjs · libs/sdk/src/stream/projections/channel-effect.ts · typescript · MIT
analytics

Acquire side-effect subscriptions over channel events with automatic cleanup.

// Source: https://github.com/langchain-ai/langgraphjs | License: MIT | Copyright 2024 LangChain
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Side-effect counterpart to {@link channelProjection}.
 *
 * Where `channelProjection` retains a bounded *buffer* of raw events
 * for rendering, this helper delivers each event to a callback exactly
 * once — the idiomatic shape for analytics, logging, and other side
 * effects that should not live in render. Framework bindings wrap it as
 * `useChannelEffect` (React/Svelte/Vue) / `injectChannelEffect`
 * (Angular).
 *
 * # Why this is built on the registry
 *
 * It acquires the very same ref-counted {@link channelProjection} entry
 * that the selector hooks use, so:
 *
 *  - N consumers of the same `channels`/`namespace`/o

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key