Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove singleton pattern #198

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft

feat: Remove singleton pattern #198

wants to merge 34 commits into from

Conversation

mrousavy
Copy link
Member

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 with weak_ptrs, so if they ever go out of scope, you know that the runtime was deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant