Define Callback#once()

This commit is contained in:
Jürg Lehni 2013-05-06 20:57:08 -07:00
parent b59a98f7ce
commit 8e53829e9c

View file

@ -64,6 +64,13 @@ var Callback = {
}
},
once: function(type, func) {
this.attach(type, function() {
func.apply(this, arguments);
this.detach(type, func);
});
},
fire: function(type, event) {
// Returns true if fired, false otherwise
var handlers = this._handlers && this._handlers[type];