ui/keyed_async_slot.svelte.ts view source
Reactive container for many concurrent async operations keyed by K.
generics
K
T
voidE
stringconstructor
type new <K, T = void, E = string>(options?: KeyedAsyncSlotOptions<T, E>): KeyedAsyncSlot<K, T, E>
options
KeyedAsyncSlotOptions<T, E>{}has
Reactive β true once run(key, ...) has been called and the entry hasn't been deleted.
type (key: K): boolean
key
Kbooleanget
Direct access to the underlying AsyncSlot for key, or
undefined if no run() has been issued for it yet. Reactive on
map population and on the slot's $state.raw fields.
Prefer the sugar getters ({@link loading}, {@link error}) for
templates; reach for get(key) when you need error_data, data,
or to call abort() / set() / reset() on the underlying slot.
type (key: K): AsyncSlot<T, E> | undefined
key
KAsyncSlot<T, E> | undefinedloading
Reactive β false for keys that have never been used.
type (key: K): boolean
key
Kbooleanerror
Reactive β null when the key has no entry or hasn't failed.
type (key: K): E | null
key
KE | nullfailed
Reactive β false for keys that have never been used.
type (key: K): boolean
key
Kbooleansucceeded
Reactive β false for keys that have never been used.
type (key: K): boolean
key
Kbooleankeys
Reactive iterator over every key with state.
type (): IterableIterator<K>
IterableIterator<K>values
Reactive iterator over every slot.
type (): IterableIterator<AsyncSlot<T, E>>
IterableIterator<AsyncSlot<T, E>>entries
Reactive iterator over [key, slot] pairs.
type (): IterableIterator<[K, AsyncSlot<T, E>]>
IterableIterator<[K, AsyncSlot<T, E>]>run
Run an async operation for key. Lazily creates an AsyncSlot
for the key on first use, inheriting the constructor's
map_error / preserve_error_on_retry options.
Supersession is scoped to key: a second run(key, ...) aborts
the first's signal AND drops its commit. Calls on different keys
are fully independent (each has its own AbortController).
type (key: K, fn: (signal: AbortSignal) => Promise<T>, options?: RunOptions | undefined): Promise<T | undefined>
key
Kfn
(signal: AbortSignal) => Promise<T>options?
RunOptions | undefinedPromise<T | undefined>the resolved value on success; undefined on failure,
abort, or supersession.
abort
Abort the in-flight run for key, if any. No-op when the key has
no entry. The slot stays in the map at its prior resolved status β
call {@link delete} to remove the entry entirely.
type (key: K, reason?: unknown): void
key
Kreason?
unknownvoidabort_all
Abort every in-flight run. Resolved entries stay in the map β call {@link reset} to clear them too.
type (reason?: unknown): void
reason?
unknownvoiddelete
Abort the in-flight run for key (if any) and remove the entry
from the map. After delete(key), has(key) returns false and
the sugar getters report the no-entry defaults β typically how a
UI dismisses a per-row error indicator.
type (key: K): boolean
key
Kbooleantrue if the key had an entry.
reset
Abort every in-flight run and clear the map. The keyed slot looks like a fresh instance afterwards.
type (): void
void