craftyjs.github.com

Crafty.unbind

public Boolean Crafty.unbind(String eventName, Function callback)

eventName
Name of the event to unbind
callback
Function to unbind

public Boolean Crafty.unbind(String eventName, Number callbackID)

callbackID
ID of the callback

Unbind any event from any entity or global event.

Example

   var play_gameover_sound = function () {...};
   Crafty.bind('GameOver', play_gameover_sound);
   ...
   Crafty.unbind('GameOver', play_gameover_sound);

The first line defines a callback function. The second line binds that function so that Crafty.trigger('GameOver') causes that function to run. The third line unbinds that function.

   Crafty.unbind('GameOver');

This unbinds ALL global callbacks for the event 'GameOver'. That includes all callbacks attached by Crafty.bind('GameOver', ...), but none of the callbacks attached by some_entity.bind('GameOver', ...).