Re: Proposal: Allow Promise callbacks to be removed

2018-04-23 Thread Alex Vincent
> My proposal is that we add a way of removing a particular callback, or all > callbacks, from a Promise. This is different to cancelling a Promise and > would instead happen if you want the operation to continue but are no > longer interested in running a function when the Promise is resolved or >

Re: Proposal: Allow Promise callbacks to be removed

2018-04-23 Thread Tab Atkins Jr.
On Mon, Apr 23, 2018 at 10:56 AM, Oliver Dunk wrote: > My proposal is that we add a way of removing a particular callback, or all > callbacks, from a Promise. This is different to cancelling a Promise and > would instead happen if you want the operation to continue but are no longer > intereste

Re: Re: Proposal: Allow Promise callbacks to be removed

2018-04-23 Thread Oliver Dunk
> What happens to `p2` if I "unthen" `f` from `p1`? That’s an interesting point to explore. I would intuitively say p2 continues to exist, but is never resolved or rejected. > Interesting. I have a proof of concept that would let you do this Andrea, that’s pretty much exactly what I was thinkin

Re: Proposal: Allow Promise callbacks to be removed

2018-04-23 Thread Jordan Harband
If I have `p1` and `p2 = p1.then(f)` - if I "unthen" `f` from `p2` then it's relatively clear that it simply won't be called. What happens to `p2` if I "unthen" `f` from `p1`? On Mon, Apr 23, 2018 at 11:37 AM, Andrea Giammarchi < andrea.giammar...@gmail.com> wrote: > Interesting. I have a proof

Re: Proposal: Allow Promise callbacks to be removed

2018-04-23 Thread Andrea Giammarchi
Interesting. I have a proof of concept that would let you do this: ```js new Promise(res => setTimeout(res, 1000, 'OK')) .addListeners(console.log, console.error); ``` and you could drop that listener at any time via the following test: ```js new Promise(res => setTimeout(res, 1000, 'OK')) .a

Proposal: Allow Promise callbacks to be removed

2018-04-23 Thread Oliver Dunk
My proposal is that we add a way of removing a particular callback, or all callbacks, from a Promise. This is different to cancelling a Promise and would instead happen if you want the operation to continue but are no longer interested in running a function when the Promise is resolved or reject