Interface used by cancelable operations to monitor whether cancellation has occurred.

Note that this interface does not provide any way to trigger cancellation; for that, CancellationTokenSource is used.

Hierarchy

  • CancellationToken

Implemented by

Properties

Methods

Properties

isCanceled: boolean

Indicates whether cancellation has occurred.

Methods

  • Add a cancellation handler function. The handler will be invoked synchronously if this.isCanceled === true. Otherwise, it will be invoked synchronously upon cancellation, unless it is removed prior to cancellation.

    The handler function must not throw any exceptions when called.

    Precondition

    The handler function must not already be registered.

    Returns

    A function that unregisters the handler.

    Parameters

    • handler: (() => void)

      The handler function to add.

        • (): void
        • Returns void

    Returns (() => void)

      • (): void
      • Add a cancellation handler function. The handler will be invoked synchronously if this.isCanceled === true. Otherwise, it will be invoked synchronously upon cancellation, unless it is removed prior to cancellation.

        The handler function must not throw any exceptions when called.

        Precondition

        The handler function must not already be registered.

        Returns

        A function that unregisters the handler.

        Returns void

  • Unregister a cancellation handler function. If this.isCanceled, or the specified handler function has not been registered, then this function has no effect.

    Parameters

    • handler: (() => void)
        • (): void
        • Returns void

    Returns void

Generated using TypeDoc