15:47 | <littledan> | There's some related discussion on Mastodon! https://hachyderm.io/@develwithoutacause@techhub.social/109488473692344107 |
15:47 | <littledan> | Doug, who started the thread and works on Angular, might be thinking about their use of zone.js |
15:48 | <littledan> | Does anyone want to get in touch with Doug and Minko for a review of AsyncContext from Angular's perspective? |
15:49 | <littledan> | Misko Hevery (of Angular fame) did a quick review of the AsyncContext API. He told me it seemed good to focus on just one aspect, but that Angular would still miss the ability to run a callback "when the microtask queue becomes empty" (a concept which isn't very composition-friendly, but which Angular needs to decide when to render to the DOM) |
16:08 | <Justin Ridgewell> | That sounds like they need a scheduling API |
16:10 | <littledan> | I think they need an API analogous to requestAnimationFrame but that runs a little earlier |
16:11 | <littledan> | anyway they currently implement this by patching promises and also transpiling async/await such that it uses those promises. This lets them implement both AsyncContext and a mechanism to count how many outstanding microtask queue items there are |
16:11 | <littledan> | so AsyncContext alone will not solve the whole problem that they are patching promises for. Anyway, I agree with Misko that we shouldn't attempt to solve their whole problem |
17:23 | <Kris Kowal> | Misko Hevery (of Angular fame) did a quick review of the AsyncContext API. He told me it seemed good to focus on just one aspect, but that Angular would still miss the ability to run a callback "when the microtask queue becomes empty" (a concept which isn't very composition-friendly, but which Angular needs to decide when to render to the DOM) |
17:25 | <Kris Kowal> | The latter we invoke from outside the execution context. Doing the same from inside an execution context is a bit of an ouroboros, or as littledan put it, doesn’t compose well. |
17:25 | <littledan> | At Agoric, we have historically drained the microtask queue in two different ways. You can approximate it with setImmediate, since it enqueues an event on the I/O queue. But, now we use a privileged API provided by XS that lets us dispatch an event and wait for the event loop to quiesce. |