Skip to main content Link Search Menu Expand Document (external link)

TSubscriptionRef overview

Added in v3.10.0


Table of contents


constructors

make

Signature

export declare const make: <A>(value: A) => STM.STM<TSubscriptionRef<A>>

Added in v3.10.0

models

TSubscriptionRef (interface)

A TSubscriptionRef<A> is a TRef that can be subscribed to in order to receive a TDequeue<A> of the current value and all committed changes to the value.

Signature

export interface TSubscriptionRef<in out A> extends TSubscriptionRef.Variance<A>, TRef.TRef<A> {
  /** @internal */
  readonly ref: TRef.TRef<A>
  /** @internal */
  readonly pubsub: TPubSub.TPubSub<A>
  /** @internal */
  modify<B>(f: (a: A) => readonly [B, A]): STM.STM<B>

  /**
   * A TDequeue containing the current value of the `Ref` as well as all changes
   * to that value.
   */
  readonly changes: STM.STM<TQueue.TDequeue<A>>
}

Added in v3.10.0

mutations

changes

Signature

export declare const changes: <A>(self: TSubscriptionRef<A>) => STM.STM<TQueue.TDequeue<A>>

Added in v3.10.0

changesScoped

Signature

export declare const changesScoped: <A>(
  self: TSubscriptionRef<A>
) => Effect.Effect<TQueue.TDequeue<A>, never, Scope.Scope>

Added in v3.10.0

changesStream

Signature

export declare const changesStream: <A>(self: TSubscriptionRef<A>) => Stream.Stream<A>

Added in v3.10.0

get

Signature

export declare const get: <A>(self: TSubscriptionRef<A>) => STM.STM<A>

Added in v3.10.0

getAndSet

Signature

export declare const getAndSet: {
  <A>(value: A): (self: TSubscriptionRef<A>) => STM.STM<A>
  <A>(self: TSubscriptionRef<A>, value: A): STM.STM<A>
}

Added in v3.10.0

getAndUpdate

Signature

export declare const getAndUpdate: {
  <A>(f: (a: A) => A): (self: TSubscriptionRef<A>) => STM.STM<A>
  <A>(self: TSubscriptionRef<A>, f: (a: A) => A): STM.STM<A>
}

Added in v3.10.0

getAndUpdateSome

Signature

export declare const getAndUpdateSome: {
  <A>(f: (a: A) => Option.Option<A>): (self: TSubscriptionRef<A>) => STM.STM<A>
  <A>(self: TSubscriptionRef<A>, f: (a: A) => Option.Option<A>): STM.STM<A>
}

Added in v3.10.0

modify

Signature

export declare const modify: {
  <A, B>(f: (a: A) => readonly [B, A]): (self: TSubscriptionRef<A>) => STM.STM<B>
  <A, B>(self: TSubscriptionRef<A>, f: (a: A) => readonly [B, A]): STM.STM<B>
}

Added in v3.10.0

modifySome

Signature

export declare const modifySome: {
  <A, B>(fallback: B, f: (a: A) => Option.Option<readonly [B, A]>): (self: TSubscriptionRef<A>) => STM.STM<B>
  <A, B>(self: TSubscriptionRef<A>, fallback: B, f: (a: A) => Option.Option<readonly [B, A]>): STM.STM<B>
}

Added in v3.10.0

set

Signature

export declare const set: {
  <A>(value: A): (self: TSubscriptionRef<A>) => STM.STM<void>
  <A>(self: TSubscriptionRef<A>, value: A): STM.STM<void>
}

Added in v3.10.0

setAndGet

Signature

export declare const setAndGet: {
  <A>(value: A): (self: TSubscriptionRef<A>) => STM.STM<A>
  <A>(self: TSubscriptionRef<A>, value: A): STM.STM<A>
}

Added in v3.10.0

update

Signature

export declare const update: {
  <A>(f: (a: A) => A): (self: TSubscriptionRef<A>) => STM.STM<void>
  <A>(self: TSubscriptionRef<A>, f: (a: A) => A): STM.STM<void>
}

Added in v3.10.0

updateAndGet

Signature

export declare const updateAndGet: {
  <A>(f: (a: A) => A): (self: TSubscriptionRef<A>) => STM.STM<A>
  <A>(self: TSubscriptionRef<A>, f: (a: A) => A): STM.STM<A>
}

Added in v3.10.0

updateSome

Signature

export declare const updateSome: {
  <A>(f: (a: A) => Option.Option<A>): (self: TSubscriptionRef<A>) => STM.STM<void>
  <A>(self: TSubscriptionRef<A>, f: (a: A) => Option.Option<A>): STM.STM<void>
}

Added in v3.10.0

updateSomeAndGet

Signature

export declare const updateSomeAndGet: {
  <A>(f: (a: A) => Option.Option<A>): (self: TSubscriptionRef<A>) => STM.STM<A>
  <A>(self: TSubscriptionRef<A>, f: (a: A) => Option.Option<A>): STM.STM<A>
}

Added in v3.10.0

symbols

TSubscriptionRefTypeId

Signature

export declare const TSubscriptionRefTypeId: typeof TSubscriptionRefTypeId

Added in v3.10.0

TSubscriptionRefTypeId (type alias)

Signature

export type TSubscriptionRefTypeId = typeof TSubscriptionRefTypeId

Added in v3.10.0

utils

TSubscriptionRef (namespace)

Added in v3.10.0

Variance (interface)

Signature

export interface Variance<in out A> {
  readonly [TSubscriptionRefTypeId]: {
    readonly _A: Types.Invariant<A>
  }
}

Added in v3.10.0