effect-io-ai

Package: effect
Module: TxSubscriptionRef

TxSubscriptionRef.make

Creates a new TxSubscriptionRef with the specified initial value.

When to use

Use to create a TxSubscriptionRef that publishes every committed update to subscribers.

Example (Creating a transactional subscription reference)

import { Effect, TxSubscriptionRef } from "effect"

const program = Effect.gen(function*() {
  const ref = yield* TxSubscriptionRef.make(42)
  const value = yield* TxSubscriptionRef.get(ref)
  console.log(value) // 42
})

See

Signature

declare const make: <A>(value: A) => Effect.Effect<TxSubscriptionRef<A>>

Source

Since v3.10.0