Sometimes it's need to cancel a promise, i.e. to stop the execution of the underlying action (and force the associated handlers to be invoked).
However, by design, promises don't offer this feature because most asynchronous actions can't be canceled nor stopped once started (for example, although you can abort an AJAX request, there is no guarantee that the server won't execute the request anyway).
Nevertheless, a common workaround used to achieve a cancel-like behavior is to invoke the promise's handlers before the associated asynchronous action has finished, and later (when the action finish) discard the action's result.
This workaround is useful mainly for read actions (like GET requests), that don't modifies data (since ignoring the result of write actions might produce unexpected results).
For example, let's say there is a single-page application that displays tabs whose content is loaded dynamically using AJAX. If an user clicks on a tab and then, before the tab's con