@thi.ng/rstream
Version:
Reactive streams & subscription primitives for constructing dataflow graphs / pipelines
31 lines • 1.07 kB
TypeScript
import { type CommonOpts } from "./api.js";
import { Subscription } from "./subscription.js";
export interface TimeoutOpts extends CommonOpts {
/**
* Error object.
*/
error: any;
/**
* True, if timeout resets with each received value.
*
* @defaultValue false
*/
reset: boolean;
}
/**
* Returns a {@link Subscription} that calls the
* {@link ISubscriber.error} handlers of all child subscriptions with an
* arbitrary error object after a given time.
*
* @remarks
* If no `error` is given, uses a new `Error` instance by default. If
* `resetTimeout` is false (default), the error is emitted regardless of
* any received values in the meantime. However, if `true`, the timeout
* resets with each received value and then only triggers once the time
* interval since the last value has exceeded.
*
* @param timeoutMs - timeout period in milliseconds
* @param opts -
*/
export declare const timeout: <T>(timeoutMs: number, opts?: Partial<TimeoutOpts>) => Subscription<T, T>;
//# sourceMappingURL=timeout.d.ts.map