Crafty.unbind()
public Boolean Crafty.unbind(String eventName, Function callback)
- eventName
Name of the event to unbind
- callback
Function to unbind
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', ...)
.