Closed saschanaz closed 8 years ago
Hey, something similar to this was suggested to the TC in the May meeting and got declined and shot down because some committee members believe it lets one modify behavior by the consumer.
This is a separate proposal, and not an issue with the proposal being developed in this repo. So, I'll close this issue. You're welcome to continue using it as a discussion thread for your proposal, but in general there are better places to do that, such as es-discuss or your own GitHub repo you created for your proposal.
As far as I can tell your proposal fails to solve the basic question, "how do I cancel a fetch?" With the proposal being developed in this repo, it's
const { token, cancel } = CancelToken.source();
fetch(url, { cancelToken: token });
cancelButton.onclick = cancel;
Whereas your proposal allows marking functions as cancelable, but doesn't allow actually canceling them in any way.
PS: This proposal continues here
I tried making a short proposal for cancelation as I don't like that I have to pass a new object for cancelation (related to https://github.com/zenparsing/es-cancel-token/issues/2). This proposal uses
chain
object to chain and cancel promises. This is not a firm proposal but I think it can be food for for further thought.I post this here because it also affects the parameter list of Promise constructor callback.
API Design difference
new Promise((resolve, reject, chain) => { /* ... */ });
The following is the structure of
chain
object.Use
Syntax sugar
A
cancelable function
has a newchain
keyword in its function scope.