-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
cannot initialize multiple canvases when using workers #107
Comments
Just curious if there is a branch with this, I'm going to need to fix this bug for a project I'm currently working on, and wondering if theres a starting point I could use and submit back a PR for. |
There's no branch for this yet. I would probably try to just create a new worker for each instance that is created, and see how that works out. Let me know if you run into any trouble |
Yea, that was my first instinct instead of trying to get the worker to have multiple canvas instances inside it. I wasn't sure if it's better to attach the worker to the canvas element or to use a They both work fine, and because the workers require Theres something to be said for not wanting to store the worker on the canvas element (which is already stated to be out of the users control once workers are enabled), though it would expose it on the canvas so the user could By storing in the Map, its not polluting the DOM element, but I'm not sure if there are any hooks exposed that would allow for the user to destroy the worker. Either one seems sufficient for my purposes, so if you have a preference, I can add tests to whichever version and get a PR put up. |
Hmm... I have been meaning to move over a few things into a I guess currently, I have a slight preference for storing it on the canvas object, due to memory concerns. And speaking of memory concerns (I know this is not a review yet), we'll now want to make sure to call |
Yeah this is an issue when working with react atm. Any fix for it? |
Currently, workers only accept a single canvas, so multiple instances cannot be used along with
useWorker
.Steps:
Expected: both demos work in their own canvases
Actual: once the second demo is started, the first demo starts populating confetti in the custom canvas
The text was updated successfully, but these errors were encountered: