A way to fire logic at the end of completion of the current class method (regardless of super call order).

#!/JoePea joe at trusktr.io
Fri Feb 8 06:21:32 UTC 2019

I many times find myself in cases where a base class wants to ensure that
logic is always fired after the current method's execution, so that for
example no matter in which order sub classes call the `super` method, the
`super` method can still guarantee that logic fires after the whole stack
of the same method in the class hierarchy.

So what I can do now is use `Promise.resolve().then(() => { ... })` to
schedule that logic for later, that way all the invocations of a `foo`
method along the class hierarchy have all fired. But this means that other
code can also fire before the next microtask.

Is there some way to do it? If not, I wonder if some language feature for
doing it would be possible?

- Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190207/98db0d43/attachment.html>

More information about the es-discuss mailing list