Quantcast
Channel: Latest Questions by Gillissie
Viewing all articles
Browse latest Browse all 93

Is there a way to make a class destructor in javascript?

$
0
0

I have classes that instantiate game objects. I want the game objects to get destroyed when the owner object is destroyed through normal means (garbage collection I suppose). This could easily be done by using a destructor, but is this possible in Javascript?

As a workaround, I manually call a cleanup method immediately before clearing the last reference to the object, but that's not as elegant.


Viewing all articles
Browse latest Browse all 93

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>