<A>(value: A): Effect.Effect<SubscriptionRef<A>>Constructs a new SubscriptionRef from an initial value.
When to use
Use to create a SubscriptionRef when consumers need to read the latest
value and subscribe to every update.
Details
The initial value is published during construction, so changes starts new
subscribers with that value before future updates.
export const const make: <A>(
value: A
) => Effect.Effect<SubscriptionRef<A>>
Constructs a new SubscriptionRef from an initial value.
When to use
Use to create a SubscriptionRef when consumers need to read the latest
value and subscribe to every update.
Details
The initial value is published during construction, so changes starts new
subscribers with that value before future updates.
make = <function (type parameter) A in <A>(value: A): Effect.Effect<SubscriptionRef<A>>A>(value: Avalue: function (type parameter) A in <A>(value: A): Effect.Effect<SubscriptionRef<A>>A): import EffectEffect.type Effect.Effect = /*unresolved*/ anyEffect<interface SubscriptionRef<in out A>A mutable reference whose updates are serialized and published to
subscribers.
When to use
Use to observe the current value and subsequent updates as a
stream.
The SubscriptionRef namespace containing type definitions associated with
subscription references.
SubscriptionRef<function (type parameter) A in <A>(value: A): Effect.Effect<SubscriptionRef<A>>A>> =>
import EffectEffect.map(import PubSubPubSub.unbounded<function (type parameter) A in <A>(value: A): Effect.Effect<SubscriptionRef<A>>A>({ replay: numberreplay: 1 }), (pubsub: PubSub.PubSub<A>(parameter) pubsub: {
pubsub: PubSub.Atomic<A>;
subscribers: PubSub.Subscribers<A>;
scope: Scope.Closeable;
shutdownHook: Latch.Latch;
shutdownFlag: MutableRef.MutableRef<boolean>;
strategy: PubSub.Strategy<A>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
pubsub) => {
const const self: anyself = var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.create(o: object | null): any (+1 overload)Creates an object that has the specified prototype or that has null prototype.
create(const Proto: {
"~effect/SubscriptionRef": {
_A: <A>(a: A) => A
}
toJSON(this: SubscriptionRef<unknown>): {
_id: string
value: unknown
}
pipe(): unknown
toString(): string
[NodeInspectSymbol](): any
}
Proto)
const self: anyself.semaphore = import SemaphoreSemaphore.makeUnsafe(1)
const self: anyself.value = value: Avalue
const self: anyself.pubsub = pubsub: PubSub.PubSub<A>(parameter) pubsub: {
pubsub: PubSub.Atomic<A>;
subscribers: PubSub.Subscribers<A>;
scope: Scope.Closeable;
shutdownHook: Latch.Latch;
shutdownFlag: MutableRef.MutableRef<boolean>;
strategy: PubSub.Strategy<A>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
pubsub
import PubSubPubSub.publishUnsafe(const self: anyself.pubsub, value: Avalue)
return const self: anyself
})