Cancellable

commands. Cancellable

A Cancellation Token (ct) that commands can check for cancellation. Commands should regularly check for the isCancelled attribute and exit eagerly if true. Keeps a list of timeout IDs issued by setTimeout calls and cancels them all when cancel is called, setting the isCancelled attribute to true.

Constructor

new Cancellable()

Description:
  • Cancellable constructor.

Source:

Members

isCancelled

Description:
  • If the Cancellation Token is cancelled. Starts off as false.

Source:

If the Cancellation Token is cancelled. Starts off as false.

Methods

(package) add(timeoutID, resolve)

Description:
  • Registers the given timeout ID and Promise resolve function.

Source:
Parameters:
Name Type Description
timeoutID

Timeout ID, the result of calling setTimeout, platform dependent.

resolve function

Resolve function for a Promise to be called if the timeout is cancelled.

cancel()

Description:
  • Cancels all registered timeouts. Sets isCancelled to true. Cancellation means calling clearTimeout with the stored timeout IDs and calling the related resolve functions.

Source:

(package) del(timeoutID)

Description:
  • Unregisters the given timeout ID, when the timeout is reached and does not need to be cancelled anymore, or if it was cancelled.

Source:
Parameters:
Name Type Description
timeoutID

Timeout ID to unregister.