The idea is that we have one default context (one member of WorkletsApi), and everything else is instance based so it has to be passed down to callers.
I also want to add a global.__dispatcher to every Runtime so that it's easy to find your way back into a Runtime after dispatching away from it (e.g. for callbacks or to resolve promises).
Those dispatchers can always be held with weak_ptrs, so if they ever go out of scope, you know that the runtime was deleted.
Remove the static singleton pattern from the app.
The idea is that we have one default context (one member of
WorkletsApi
), and everything else is instance based so it has to be passed down to callers.I also want to add a
global.__dispatcher
to every Runtime so that it's easy to find your way back into a Runtime after dispatching away from it (e.g. for callbacks or to resolve promises). Those dispatchers can always be held withweak_ptr
s, so if they ever go out of scope, you know that the runtime was deleted.