-
Notifications
You must be signed in to change notification settings - Fork 25
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 find a way to unmount/remove a game from a page. #42
Comments
I hadn't considered this to be a thing that tenuki should solve for. I think my expectation is that removing a board from the page is very likely to require you to handle the empty content in some way, and everyone's needs would be slightly different. Are you able to keep a handle on the DOM element you gave to the game constructor and remove it from the DOM with, say, |
I had some problems with a memory leak. But maybe if I remove the passed element all event listeners and such will be gone as well? I tried just clearing the innerHTML of that element but that did not seem to fix it. |
Found the problem. Lines like this have access to the closure of the function that defines them, so the closure for the event handler will keep all references alive from that scope. Since the event is on window the handler will never be collected. Causing it to remain alive and keep everything else in memory. Line 149 in 5b1f28b
There is also closures created for requestAnimationFrame. And probably others I haven't found yet. |
I am interested in this too - trying to set up a way to practice various joseki repeatedly, and I'm looking for an efficient way to "reset" or remove/recreate the board. Is there any change or workarounds that have arisen in the last few years? |
Have been looking into the source and cannot find a way to remove a game from a page?
Is this not a use case that was designed for or maybe just overlooked?
The text was updated successfully, but these errors were encountered: