Saturday, 15 January 2011

garbage collection - Javascript object with precise lifetime / run code at end of scope -



garbage collection - Javascript object with precise lifetime / run code at end of scope -

it helpful have objects lifetime tightly related scope. illustration in c++, destructor auto objects. in c#, dispose within using block.

i want know if there's way in javascript.

the illustration comes mind logging object can measure time spent in function. this:

in c++:

void somefunction() { logscopemessage lsm("in function"); ... }

in c#:

private void somefunction() { using(auto lsm = new logscopemessage("in function")) { ... } }

.... , in javascript best way set kind of idiom?

javascript garbage-collection object-lifetime

No comments:

Post a Comment