/** * @since 4.0.0 */ import * as Context from "../../Context.ts"; import * as Effect from "../../Effect.ts"; import * as Layer from "../../Layer.ts"; import type { Scheduler } from "../../Scheduler.ts"; import * as Scope from "../../Scope.ts"; import * as Stream from "../../Stream.ts"; import * as Result from "./AsyncResult.ts"; import type * as Atom from "./Atom.ts"; /** * @since 4.0.0 * @category type ids */ export type TypeId = "~effect/reactivity/AtomRegistry"; /** * @since 4.0.0 * @category type ids */ export declare const TypeId: TypeId; /** * @since 4.0.0 * @category guards */ export declare const isAtomRegistry: (u: unknown) => u is AtomRegistry; /** * @since 4.0.0 * @category models */ export interface AtomRegistry { readonly [TypeId]: TypeId; readonly scheduler: Scheduler; readonly schedulerAsync: Scheduler; readonly getNodes: () => ReadonlyMap | string, Node>; readonly get: (atom: Atom.Atom) => A; readonly mount: (atom: Atom.Atom) => () => void; readonly refresh: (atom: Atom.Atom) => void; readonly set: (atom: Atom.Writable, value: W) => void; readonly setSerializable: (key: string, encoded: unknown) => void; readonly modify: (atom: Atom.Writable, f: (_: R) => [returnValue: A, nextValue: W]) => A; readonly update: (atom: Atom.Writable, f: (_: R) => W) => void; readonly subscribe: (atom: Atom.Atom, f: (_: A) => void, options?: { readonly immediate?: boolean; }) => () => void; readonly reset: () => void; readonly dispose: () => void; onNodeAdded?: ((node: Node) => void) | undefined; onNodeRemoved?: ((node: Node) => void) | undefined; } /** * @since 4.0.0 * @category models */ export interface Node { readonly atom: Atom.Atom; readonly value: () => A; parents: Array>; children: Array>; listeners: Set<() => void>; currentState(): "uninitialized" | "stale" | "valid" | "removed"; } /** * @since 4.0.0 * @category constructors */ export declare const make: (options?: { readonly initialValues?: Iterable, any]> | undefined; readonly scheduleTask?: ((f: () => void) => () => void) | undefined; readonly timeoutResolution?: number | undefined; readonly defaultIdleTTL?: number | undefined; } | undefined) => AtomRegistry; /** * @since 4.0.0 * @category Tags */ export declare const AtomRegistry: Context.Service; /** * @since 4.0.0 * @category Layers */ export declare const layerOptions: (options?: { readonly initialValues?: Iterable, any]> | undefined; readonly scheduleTask?: ((f: () => void) => () => void) | undefined; readonly timeoutResolution?: number | undefined; readonly defaultIdleTTL?: number | undefined; }) => Layer.Layer; /** * @since 4.0.0 * @category Layers */ export declare const layer: Layer.Layer; /** * @since 4.0.0 * @category Conversions */ export declare const toStream: { /** * @since 4.0.0 * @category Conversions */ (atom: Atom.Atom): (self: AtomRegistry) => Stream.Stream; /** * @since 4.0.0 * @category Conversions */ (self: AtomRegistry, atom: Atom.Atom): Stream.Stream; }; /** * @since 4.0.0 * @category Conversions */ export declare const toStreamResult: { /** * @since 4.0.0 * @category Conversions */ (atom: Atom.Atom>): (self: AtomRegistry) => Stream.Stream; /** * @since 4.0.0 * @category Conversions */ (self: AtomRegistry, atom: Atom.Atom>): Stream.Stream; }; /** * @since 4.0.0 * @category Conversions */ export declare const getResult: { /** * @since 4.0.0 * @category Conversions */ (atom: Atom.Atom>, options?: { readonly suspendOnWaiting?: boolean | undefined; }): (self: AtomRegistry) => Effect.Effect; /** * @since 4.0.0 * @category Conversions */ (self: AtomRegistry, atom: Atom.Atom>, options?: { readonly suspendOnWaiting?: boolean | undefined; }): Effect.Effect; }; /** * @since 4.0.0 * @category Conversions */ export declare const mount: { /** * @since 4.0.0 * @category Conversions */ (atom: Atom.Atom): (self: AtomRegistry) => Effect.Effect; /** * @since 4.0.0 * @category Conversions */ (self: AtomRegistry, atom: Atom.Atom): Effect.Effect; }; //# sourceMappingURL=AtomRegistry.d.ts.map