Cancelable promises proposal
Boris Zbarsky
bzbarsky at mit.edu
Mon Aug 3 15:49:51 UTC 2015
On 8/2/15 8:43 PM, Glen Huang wrote:
> You can think it as that each promise keeps a list of its child promises, when the same callback is passed to .ignore() it sets a flag on the corresponding child promise so that when itself resolves/rejects, it won't pass that state to that child promise
There seems to be a potential footgun here. Say I call then() twice
with the same function. Now I have two child promises. If I now call
ignore() with that function, which of the child promises is ignored?
Both? Just one of them? Something else?
This situation doesn't _quite_ arise with add/removeEventListener,
because you can't addEventListener a given listener twice to the same
event target. So a removeEventListener can see at most one matching
listener.
-Boris
More information about the es-discuss
mailing list