mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
Events.clear is now Events.off
This commit is contained in:
parent
b253683cb5
commit
aa42f1653f
1 changed files with 19 additions and 19 deletions
|
@ -28,9 +28,27 @@ var Events = {};
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears all callbacks for the given event names if supplied, otherwise all events
|
||||
* @method off
|
||||
* @param {} object
|
||||
* @param {string} eventNames
|
||||
*/
|
||||
Events.off = function(object, eventNames) {
|
||||
if (!eventNames) {
|
||||
object.events = {};
|
||||
return;
|
||||
}
|
||||
|
||||
var names = eventNames.split(' ');
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
object.events[names[i]] = [];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Fires all the callbacks subscribed to the given object's eventName, in the order they subscribed, if any
|
||||
* @method fire
|
||||
* @method trigger
|
||||
* @param {} object
|
||||
* @param {string} eventNames
|
||||
* @param {} event
|
||||
|
@ -64,22 +82,4 @@ var Events = {};
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears all callbacks for the given event names if supplied, otherwise all events
|
||||
* @method clear
|
||||
* @param {} object
|
||||
* @param {string} eventNames
|
||||
*/
|
||||
Events.clear = function(object, eventNames) {
|
||||
if (!eventNames) {
|
||||
object.events = {};
|
||||
return;
|
||||
}
|
||||
|
||||
var names = eventNames.split(' ');
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
object.events[names[i]] = [];
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
Loading…
Reference in a new issue