On 12/2/20 9:01 AM, Miles wrote:
> I'm assuming that there is something extra I have to do to implement promises in our embedding.
> I currently use the debugger API in our embedding so I have a call to
> which is required to get that to work and I had hoped this would magically mean that promises would work here too.
> Clearly there is something that I'm missing though. I'm guessing it means that I need to do something with a job queue/event loop to 'process' the promises but I have no idea what.
> Can anybody point me in the right direction?
First, I don't know.
Second, it looks like from both shell/js.cpp and
that you need to be calling js::RunJobs(cx) periodically, probably when
returning from a toplevel JS invocation. So I'm guessing that's the
It may be that for your embedding you'll want to switch over at some
point to using InitDispatchToEventLoop to better integrate with your
event loop, and improve the semantics -- as in, have tasks running at
the right time, better matching HTML semantics. (I think it's HTML, not
JS?) But for now, I think you're probably right that using the internal
job queue is easier to start with.