mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
Define Callback#once()
This commit is contained in:
parent
b59a98f7ce
commit
8e53829e9c
1 changed files with 7 additions and 0 deletions
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue