Is there any way to find out the garbage collector of javascript destroyed the object like in c# or java?
I have a distributed system that needs to inform other nodes if objects are no longer used.
I don’t want to use any dispose function to actively destroy the object.
We even were able to do this in Flash using Weak References,… so if anyone has an idea how to implement weak references in javascript – this would solve the problem too.
I need it to work cross browser (or at least a solution for the most important browsers).
(i remember a solution for firefox only is existing – but that would not solve my problem)
Just to be clear: I don’t need any solution that actively involves calling destructors.
No, there is no built-in way to know when the GC collects an object in the standard, nor any that’s non-standard but well-supported across implementations. There are a couple of proposals out vaguely related to it, like weak maps, but nothing you can use now.