Skip to content

CancellationToken interface

Ron Buckton edited this page Jan 15, 2015 · 2 revisions

Propagates notifications that operations should be cancelled.

Syntax

export interface CancellationToken {
  canceled: boolean;
  reason: any;
  throwIfCanceled(): void;
  register(callback: (reason: any) => void): CancellationRegistration;
}

Properties

canceled
Gets a value indicating whether the token has received a cancellation signal.
reason
Gets the reason for cancellation, if one was supplied.

Methods

throwIfCancelled()
Throws an `Error` if the token has received a cancellation signal.
register(Function)
Registers a callback used to perform additional cleanup when the token is canceled, and returns a CancellationRegistration that can be used to unregister the callback.

Requirements

  • Supported Platforms: TBD
  • Module: cancellation
  • Library: cancellation.ts

See Also

Clone this wiki locally