function / @typed/fx/Versioned

hold

Holds the latest value of a Versioned stream.

Package version
2.0.0-beta.7
Category
Shared observation
Since
1.0.0

Import

import { hold } from "@typed/fx/Versioned";

Signatures

export declare function hold<R0, E0, A, E, R, B, E2, R2>(versioned: Versioned<R0, E0, A, E, R, B, E2, R2>): Versioned<R0, E0, A, E, R | Scope.Scope, B, E2, R2>;

Why

Retains the latest pushed value for later subscribers while leaving current-value reads delegated to the original Versioned Effect.

Ownership and lifetime

The returned Fx requires Scope; its shared upstream subscription and retained buffer are finalized when that Scope closes. Current reads retain input errors and services.

Examples

import { Effect } from "effect"
import * as Versioned from "@typed/fx/Versioned"

const program = Effect.scoped(Effect.gen(function* () {
  const shared = Versioned.hold(Versioned.of({ status: "ready" as const }))
  return yield* shared
}))

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source