<A>(self: ScopedRef<A>): ARetrieves the current value of the scoped reference synchronously.
When to use
Use when you need immediate synchronous access to the current ScopedRef
value and can guarantee that reading outside the Effect API is safe.
export const const getUnsafe: <A>(
self: ScopedRef<A>
) => A
Retrieves the current value of the scoped reference synchronously.
When to use
Use when you need immediate synchronous access to the current ScopedRef
value and can guarantee that reading outside the Effect API is safe.
getUnsafe = <function (type parameter) A in <A>(self: ScopedRef<A>): AA>(self: ScopedRef<A>(parameter) self: {
backing: Synchronized.SynchronizedRef<readonly [Scope.Closeable, 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; <…;
}
self: interface ScopedRef<in out A>A ScopedRef is a reference whose value is associated with resources,
which must be released properly. You can both get the current value of any
ScopedRef, as well as set it to a new value (which may require new
resources). The reference itself takes care of properly releasing resources
for the old value whenever a new value is obtained.
When to use
Use when an application needs to keep a current resource-backed value and
later replace it with another acquired value while ensuring the previous
value is released.
ScopedRef<function (type parameter) A in <A>(self: ScopedRef<A>): AA>): function (type parameter) A in <A>(self: ScopedRef<A>): AA => self: ScopedRef<A>(parameter) self: {
backing: Synchronized.SynchronizedRef<readonly [Scope.Closeable, 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; <…;
}
self.ScopedRef<A>.backing: Synchronized.SynchronizedRef<readonly [Scope.Closeable, A]>(property) ScopedRef<A>.backing: {
backing: Ref.Ref<A>;
semaphore: Semaphore.Semaphore;
ref: MutableRef.MutableRef<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; <…;
}
backing.SynchronizedRef<in out A>.backing: Ref.Ref<A>(property) SynchronizedRef<in out A>.backing: {
ref: MutableRef.MutableRef<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; <…;
}
backing.ref.current[1]