Expand description
Type Aliases§
Source§type Await Ret<T> = T extends (...args: any[]) => infer R ? Awaited<R> : never
type Await Ret<T> = T extends (...args: any[]) => infer R ? Awaited<R> : never
Shorthand for Awaited<ReturnType
Source§type Latest Update Args Fn<TFn> = { ... }
type Latest Update Args Fn<TFn> = { ... }
Source§type Serial Cancel Token = "cancel"
type Serial Cancel Token = "cancel"
The error type received by caller when an event is cancelled
Source§type Serial Event Cancel Callback = { ... }
type Serial Event Cancel Callback = { ... }
The callback type passed to SerialEvent constructor to be called when the event is cancelled
Functions§
Source§batch<TFn extends AnyFn>(
args: BatchConstructor<TFn>,
): (...args: Parameters<TFn>) => Promise<AwaitRet<TFn>>
batch<TFn extends AnyFn>(
args: BatchConstructor<TFn>,
): (...args: Parameters<TFn>) => Promise<AwaitRet<TFn>>
Factory for batched function. See BatchConstructor for usage.
Source§debounce<TFn extends AnyFn>(
args: DebounceConstructor<TFn>,
): (...args: Parameters<TFn>) => Promise<AwaitRet<TFn>>
debounce<TFn extends AnyFn>(
args: DebounceConstructor<TFn>,
): (...args: Parameters<TFn>) => Promise<AwaitRet<TFn>>
Factory for debounced function. See DebounceConstructor for usage
Source§latest<TFn extends AnyFn>(
args: LatestConstructor<TFn>,
): (...args: Parameters<TFn>) => Promise<AwaitRet<TFn>>
latest<TFn extends AnyFn>(
args: LatestConstructor<TFn>,
): (...args: Parameters<TFn>) => Promise<AwaitRet<TFn>>
Factory for latest. See LatestConstructor for usage.
Source§makePromise<T>(): PromiseHandle<T>
makePromise<T>(): PromiseHandle<T>
Make a PromiseHandle with the promise object separate from its resolve and reject methods
Source§once<TFn extends AnyFn>(
args: OnceConstructor<TFn>,
): (...args: Parameters<TFn>) => Promise<AwaitRet<TFn>>
once<TFn extends AnyFn>(
args: OnceConstructor<TFn>,
): (...args: Parameters<TFn>) => Promise<AwaitRet<TFn>>
Factory function for once. See OnceConstructor for usage
Source§scopedCapture<T>(fn: () => Promise<T>, obj: unknown): Promise<T>
scopedCapture<T>(fn: () => Promise<T>, obj: unknown): Promise<T>
Execute an async closure fn, and guarantee that obj will not be
garbage-collected, until the promise is resolved.
Source§scopedCaptureSync<T>(fn: () => T, obj: unknown): T
scopedCaptureSync<T>(fn: () => T, obj: unknown): T
Execute a closure fn, and guarantee that obj will not be
garbage-collected during the execution
Source§serial<TFn extends AnyFn>(
args: SerialConstructor<TFn>,
): (
...args: Parameters<TFn>,
) => Promise<Result<Awaited<ReturnType<TFn>>, "cancel">>
serial<TFn extends AnyFn>(
args: SerialConstructor<TFn>,
): (
...args: Parameters<TFn>,
) => Promise<Result<Awaited<ReturnType<TFn>>, "cancel">>
Factory function for serial. See SerialConstructor for usage
Classes§
- RwLock
Ensure you have exclusive access in concurrent code
Interfaces§
- BatchConstructor
Options to construct a
batchfunction- DebounceConstructor
Options for
debouncefunction- LatestConstructor
Args for constructing
latest- OnceConstructor
Args for constructing a
once- PromiseHandle
A handle of the promise that breaks down the promise object and its resolve and reject functions
- SerialConstructor
Options for
serialfunction
Synchronization utilities