Proposal: Allow Promise callbacks to be removed
isiahmeadows at gmail.com
Tue Apr 24 11:56:28 UTC 2018
Here's a better idea: maybe `Promise.prototype.clear(promise)` and
`Promise.prototype.add(promise)` (with a parent reference to verify
its origin, of course). You can then manage "subscriptions" via just
tracking the returned chained promises if necessary. It's technically
blanket, but keep in mind resolve/reject callbacks aren't registered
uniquely like most event callback systems are.
me at isiahmeadows.com
Looking for web consulting? Or a new website?
Send me an email and we can get started.
On Tue, Apr 24, 2018 at 6:06 AM, Oliver Dunk <oliver at oliverdunk.com> wrote:
> Based on feedback, I agree that a blanket `Promise.prototype.clear()` is a
> bad idea. I don’t think that is worth pursuing.
> I still think that there is value in this, especially the adding and
> removing of listeners you have reference to as Andrea’s PoC shows. Listeners
> would prevent the chaining issue or alternatively I think it would
> definitely be possible to decide on intuitive behaviour with the clear
> mechanic. The benefit of `clear(reference)` over listeners is that it adds
> less to the semantics.
> I think the proposed userland solutions are bigger than I would want for
> something that I believe should be available by default, but I respect that
> a lot of the people in this conversation are in a better position to make a
> judgement about that than me.
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss