Cancelable JavaScript promises cancelled

The proposed feature would have given developers more control over requests in programs, but Google pushed back

Cancelable JavaScript promises cancelled
Alachua County (CC BY 2.0)

In a twist of irony, a cancelable promises capability has been cancelled as a planned addition to JavaScript itself.

The proposal had been championed by Google's Dominic Denicola but had remained in an early stage of development, according to Mozilla. Denicola declined to comment on the proposal's withdrawal except to say it was a "difficult subject." In recent comments in GitHub repo, he said the proposal had met "significant opposition from within Google."

The feature would have given developers the ability to abort a promise, a Mozilla representative said. "A prominent use case is to be able to cancel possibly longstanding requests, such as fetch requests." Cancelable promises had been proposed to the ECMA TC-39 committee overseeing the standardization of JavaScript.

While Mozilla declined to speculate on why the proposal was retracted, the company hopes another effort is made in this vein. "What has been retracted is a particular proposed solution," Mozilla said. "We believe the idea of making promises cancelable, in particular making HTML fetch cancelable, is still very much desired. We anticipate there will be other proposals."

Promises in JavaScript provide for asynchronous connection-handling, for scheduling of how code works with JavaScript APIs and functions. Comments on a Hacker News chat thread referred to cancelable promises as having no obvious way to accomplish it and questioned whether it would foment complexity and compatibility issues. For the time being, cancelable promises has met the same fate as object.observe, a JavaScript feature for observation of objects that also was axed.

Copyright © 2016 IDG Communications, Inc.