From aa42f1653f1c768c82310ced5b5b13e48a24b04f Mon Sep 17 00:00:00 2001 From: liabru Date: Mon, 24 Mar 2014 19:49:03 +0000 Subject: [PATCH] Events.clear is now Events.off --- src/core/Events.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/core/Events.js b/src/core/Events.js index 1ec08f3..f7a4469 100644 --- a/src/core/Events.js +++ b/src/core/Events.js @@ -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]] = []; - } - }; - })(); \ No newline at end of file