window.addEventListener(\'unload\', function(e)
{
MyClass.shutdown();
window.removeEventListener(\'unload\', /* how to refer to this function? */);
}, false);
>
Howto use recursion on Anonymous Functions
Lets say we have an anonymous factorial function and we want to do it recursively. How do we call a function without a name? Well in Javascript the arguments.callee property contains a pointer to the currently executing function which means an anonymous function can, indeed, call itself.
alert((function(n){ if(n <= 1){return 1;}else{return n*arguments.callee(n-1);}})(10));
source: http://www.hunlock.com/blogs/Functional_Javascript