Method: off

Remove an event listener. If the _processing flag is true then the removal will be placed in the removals array to be processed after the event loop has completed in the emit() method.
off (Boolean eventName, Object evtListener, Function callback)
  • BooleaneventName The name of the event you originally registered to listen for.
  • ObjectevtListener The event listener object to cancel. This object is the one returned when calling the on() method. It is NOT the method you passed as the second argument to the on() method.
  • Functioncallback The callback method to call when the event listener has been successfully removed. If you attempt to remove a listener during the event firing loop then the listener will not immediately be removed but will be queued for removal before the next listener loop is fired. In this case you may like to be informed via callback when the listener has been fully removed in which case, provide a method for this argument. The callback will be passed a single boolean argument denoting if the removal was successful (true) or the listener did not exist to remove (false).
Returns Boolean

Switch off an Event Listener

// Register event lister and store in "evt"
var evt = myEntity.on('mouseDown', function () { console.log('down'); });

// Switch off event listener
myEntity.off('mouseDown', evt);
© Copyright 2013 Irrelon Software Limited. All Rights Reserved. UK Registered Company Number: 07522767
Isogenic (ī´sōjen´ik): Adj originating from a common source; possessing the same genetic composition.
Strange Things Happen at the One Two Point