Newer Version Available

This content describes an older version of this product. View Latest

Abortable Actions

You can mark an action as abortable to make it potentially abortable while it's queued to be sent to the server or not yet returned from the server. This is useful for actions that you'd like to abort when there is a newer abortable action in the queue.

A set of actions for a single transaction, such as a click callback, are queued together to be sent to the server. If a user starts another transaction, for example by clicking another button, all abortable actions are removed from the queue. The aborted actions are not sent to the server and their state is set to ABORTED. If some actions have not yet returned from the server, they will complete, but their callbacks will not be called. An abortable action is sent to the server and executed normally unless it hasn’t returned from the server when a subsequent abortable action is added to the queue.

There is no requirement that the most recent abortable action has to be identical to the previous abortable actions. The most recent action just has to be marked as abortable.

Note

Mark a server-side action as abortable by using the setAbortable() method on the Action object in JavaScript. For example:

You can check for aborted actions in your callback and take appropriate action, such as logging the aborted action, if desired. For example: