UNPKG

@naturalcycles/js-lib

Version:

Standard library for universal (browser + Node.js) javascript

21 lines (20 loc) 585 B
import type { AnyFunction } from '../types.js'; /** * Similar to AbortController and AbortSignal. * Similar to pDefer and Promise. * Similar to Subject and Observable. * * Minimal interface for something that can be aborted in the future, * but not necessary. * Allows to listen to `onAbort` event. * * @experimental */ export declare class Abortable { onAbort?: AnyFunction | undefined; constructor(onAbort?: AnyFunction | undefined); aborted: boolean; abort(): void; clear(): void; } export declare function abortable(onAbort?: AnyFunction): Abortable;