Class: CancelToken

ajx.CancelToken

CancelToken handles 'cancel' events.

Constructor

new CancelToken()

Initialize this cancel token.

Source:

Members

canceled :boolean

The flag to indicate it has been canceled.

Type:
  • boolean
Source:

reason :Error

The error object which indicates the reason of cancel.

Type:
  • Error
Source:

Methods

(static) new() → {CancelToken}

Create a cancel token.

Source:
Returns:

The created token.

Type
CancelToken

(static) race(parentTokens) → {CancelToken}

Create a cancel token which will be canceled if one of the given tokens was canceled.

Parameters:
Name Type Description
parentTokens Array.<CancelToken>

The tokens to forward events.

Source:
Returns:

The created race token.

Type
CancelToken

cancel(reasonopt) → {void}

Cancel this token.

Parameters:
Name Type Attributes Description
reason Error <optional>

The error object which indicates the reason of cancel.

Source:
Returns:
Type
void

throwIfCanceled() → {void}

Throw an error if this token has been canceled already.

Source:
Returns:
Type
void