function foo () { ... }; function call_only_once () { dojo.event.disconnect( 'before', foo, call_only_once ); // Do stuff here }; dojo.event.connect( 'before', foo, call_only_once ); foo();