forked from creationix/node-sdl
-
Notifications
You must be signed in to change notification settings - Fork 1
Window garbage collected too "early" #1
Copy link
Copy link
Open
Labels
Description
In a simple test game I'm writing, I used setTimeout to get an infinite loop going with a "ticker" function that would run 60 times per second. However, due to the fact that I did not have any references to the window inside of the function that was constantly being run, node decided that the "var window = ..." bit I had farther up in the code was no longer valid and would soon garbage collect it, causing the window to be destroyed.
While this is technically not a bug, a workaround to this is desirable, so that everybody who decides to write code using setTimeout (or whatever gets provided in the SDL wrapper) does not have to have some hacky fix such as "var mywindow = window" inside of their ticker function.
Reactions are currently unavailable