mana-common
Version:
Common utils for mana
19 lines (18 loc) • 632 B
TypeScript
import { Event } from './event';
export declare type CancellationToken = {
readonly isCancellationRequested: boolean;
readonly onCancellationRequested: Event<void>;
};
export declare namespace CancellationToken {
const None: CancellationToken;
const Cancelled: CancellationToken;
}
export declare class CancellationTokenSource {
private _token?;
get token(): CancellationToken;
cancel(): void;
dispose(): void;
}
export declare function cancelled(): Error;
export declare function isCancelled(err: Error | undefined): boolean;
export declare function checkCancelled(token?: CancellationToken): void;