window.addEventListener(\'unload\', function(e) { MyClass.shutdown(); window.removeEventListener(\'unload\', /* how to refer to this function? */); }, false); >
The callee property of the arguments object always refers to the called function:
callee
arguments
window.addEventListener('unload', function(e) { MyClass.shutdown(); window.removeEventListener('unload', arguments.callee); }, false);
See: MDC: callee