Hyperlinkv0.8.0-beta.28

TxSubscriptionRef

TxSubscriptionRef.getconsteffect/TxSubscriptionRef.ts:158
<A>(self: TxSubscriptionRef<A>): Effect.Effect<A>

Reads the current value of the TxSubscriptionRef.

When to use

Use to read the current TxSubscriptionRef value without subscribing to future changes.

Example (Reading the current value)

import { Effect, TxSubscriptionRef } from "effect"

const program = Effect.gen(function*() {
  const ref = yield* TxSubscriptionRef.make("hello")
  const value = yield* TxSubscriptionRef.get(ref)
  console.log(value) // "hello"
})
getterschanges
export const get = <A>(self: TxSubscriptionRef<A>): Effect.Effect<A> => TxRef.get(self.ref)