Skip to content

SubscriptionRef

27 exports Added in v2.0.0 Source

Constructors

make

Added in v2.0.0 Source

Creates a new SubscriptionRef with the specified value.

Signature

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

Getters

get

Added in v2.0.0 Source

Signature

declare const get: <A>(self: SubscriptionRef<A>) => Effect.Effect<A>;

Models

SubscriptionRef interface

Added in v2.0.0 Source

A SubscriptionRef<A> is a Ref that can be subscribed to in order to receive the current value as well as all changes to the value.

Signature

interface SubscriptionRef<in out A> extends Variance<A>, SynchronizedRef<A>, Subscribable<A> {
readonly [ignoreSymbol]?: SubscriptionRefUnifyIgnore;
readonly [typeSymbol]?: unknown;
readonly [unifySymbol]?: SubscriptionRefUnify<SubscriptionRef<A>>;
readonly changes: Stream<A>;
}

SubscriptionRefUnify interface

Added in v3.8.0 Source

Signature

interface SubscriptionRefUnify<
A extends {
[typeSymbol]?: any;
},
> extends SynchronizedRefUnify<A> {
SubscriptionRef?: () => Extract<A[typeof typeSymbol], SubscriptionRef<any>>;
}

SubscriptionRefUnifyIgnore interface

Added in v3.8.0 Source

Signature

interface SubscriptionRefUnifyIgnore extends SynchronizedRefUnifyIgnore {
SynchronizedRef?: true;
}

Other

Symbols

Signature

declare const SubscriptionRefTypeId: unique symbol;

Signature

type SubscriptionRefTypeId = typeof SubscriptionRefTypeId;

Utils

getAndSet

Added in v2.0.0 Source

Signature

declare const getAndSet: {
<A>(value: A): (self: SubscriptionRef<A>) => Effect<A>;
<A>(self: SubscriptionRef<A>, value: A): Effect<A>;
};

getAndUpdate

Added in v2.0.0 Source

Signature

declare const getAndUpdate: {
<A>(f: (a: A) => A): (self: SubscriptionRef<A>) => Effect<A>;
<A>(self: SubscriptionRef<A>, f: (a: A) => A): Effect<A>;
};

Signature

declare const getAndUpdateEffect: {
<A, R, E>(f: (a: A) => Effect<A, E, R>): (self: SubscriptionRef<A>) => Effect<A, E, R>;
<A, R, E>(self: SubscriptionRef<A>, f: (a: A) => Effect<A, E, R>): Effect<A, E, R>;
};

Signature

declare const getAndUpdateSome: {
<A>(pf: (a: A) => Option<A>): (self: SubscriptionRef<A>) => Effect<A>;
<A>(self: SubscriptionRef<A>, pf: (a: A) => Option<A>): Effect<A>;
};

Signature

declare const getAndUpdateSomeEffect: {
<A, R, E>(pf: (a: A) => Option<Effect<A, E, R>>): (self: SubscriptionRef<A>) => Effect<A, E, R>;
<A, R, E>(self: SubscriptionRef<A>, pf: (a: A) => Option<Effect<A, E, R>>): Effect<A, E, R>;
};

modify

Added in v2.0.0 Source

Signature

declare const modify: {
<A, B>(f: (a: A) => readonly [B, A]): (self: SubscriptionRef<A>) => Effect<B>;
<A, B>(self: SubscriptionRef<A>, f: (a: A) => readonly [B, A]): Effect<B>;
};

modifyEffect

Added in v2.0.0 Source

Signature

declare const modifyEffect: {
<B, A, E, R>(
f: (a: A) => Effect<readonly [B, A], E, R>,
): (self: SubscriptionRef<A>) => Effect<B, E, R>;
<A, B, E, R>(
self: SubscriptionRef<A>,
f: (a: A) => Effect<readonly [B, A], E, R>,
): Effect<B, E, R>;
};

modifySome

Added in v2.0.0 Source

Signature

declare const modifySome: {
<B, A>(
fallback: B,
pf: (a: A) => Option<readonly [B, A]>,
): (self: SubscriptionRef<A>) => Effect<B>;
<A, B>(self: SubscriptionRef<A>, fallback: B, pf: (a: A) => Option<readonly [B, A]>): Effect<B>;
};

Signature

declare const modifySomeEffect: {
<A, B, R, E>(
fallback: B,
pf: (a: A) => Option<Effect<readonly [B, A], E, R>>,
): (self: SynchronizedRef<A>) => Effect<B, E, R>;
<A, B, R, E>(
self: SynchronizedRef<A>,
fallback: B,
pf: (a: A) => Option<Effect<readonly [B, A], E, R>>,
): Effect<B, E, R>;
};

set

Added in v2.0.0 Source

Signature

declare const set: {
<A>(value: A): (self: SubscriptionRef<A>) => Effect<void>;
<A>(self: SubscriptionRef<A>, value: A): Effect<void>;
};

setAndGet

Added in v2.0.0 Source

Signature

declare const setAndGet: {
<A>(value: A): (self: SubscriptionRef<A>) => Effect<A>;
<A>(self: SubscriptionRef<A>, value: A): Effect<A>;
};

update

Added in v2.0.0 Source

Signature

declare const update: {
<A>(f: (a: A) => A): (self: SubscriptionRef<A>) => Effect<void>;
<A>(self: SubscriptionRef<A>, f: (a: A) => A): Effect<void>;
};

updateAndGet

Added in v2.0.0 Source

Signature

declare const updateAndGet: {
<A>(f: (a: A) => A): (self: SubscriptionRef<A>) => Effect<A>;
<A>(self: SubscriptionRef<A>, f: (a: A) => A): Effect<A>;
};

Signature

declare const updateAndGetEffect: {
<A, R, E>(f: (a: A) => Effect<A, E, R>): (self: SubscriptionRef<A>) => Effect<A, E, R>;
<A, R, E>(self: SubscriptionRef<A>, f: (a: A) => Effect<A, E, R>): Effect<A, E, R>;
};

updateEffect

Added in v2.0.0 Source

Signature

declare const updateEffect: {
<A, R, E>(f: (a: A) => Effect<A, E, R>): (self: SynchronizedRef<A>) => Effect<void, E, R>;
<A, R, E>(self: SynchronizedRef<A>, f: (a: A) => Effect<A, E, R>): Effect<void, E, R>;
};

updateSome

Added in v2.0.0 Source

Signature

declare const updateSome: {
<A>(f: (a: A) => Option<A>): (self: SubscriptionRef<A>) => Effect<void>;
<A>(self: SubscriptionRef<A>, f: (a: A) => Option<A>): Effect<void>;
};

Signature

declare const updateSomeAndGet: {
<A>(pf: (a: A) => Option<A>): (self: SubscriptionRef<A>) => Effect<A>;
<A>(self: SubscriptionRef<A>, pf: (a: A) => Option<A>): Effect<A>;
};

Signature

declare const updateSomeAndGetEffect: {
<A, R, E>(pf: (a: A) => Option<Effect<A, E, R>>): (self: SubscriptionRef<A>) => Effect<A, E, R>;
<A, R, E>(self: SubscriptionRef<A>, pf: (a: A) => Option<Effect<A, E, R>>): Effect<A, E, R>;
};

Signature

declare const updateSomeEffect: {
<A, R, E>(
pf: (a: A) => Option<Effect<A, E, R>>,
): (self: SynchronizedRef<A>) => Effect<void, E, R>;
<A, R, E>(self: SynchronizedRef<A>, pf: (a: A) => Option<Effect<A, E, R>>): Effect<void, E, R>;
};