@difizen/mana-common
Version:
20 lines • 743 B
TypeScript
import { Event } from './event';
export type CancellationToken = {
readonly isCancellationRequested: boolean;
readonly onCancellationRequested: Event<void>;
};
export declare namespace CancellationToken {
function is(thing: unknown): thing is CancellationToken;
const None: CancellationToken;
const Cancelled: CancellationToken;
}
export declare class CancellationTokenSource {
private _token?;
get token(): CancellationToken;
cancel(): void;
dispose(cancel?: boolean): void;
}
export declare function cancelled(): Error;
export declare function isCancelled(err: Error | undefined): boolean;
export declare function checkCancelled(token?: CancellationToken): void;
//# sourceMappingURL=cancellation.d.ts.map