From 3caee55366ac21ea4aa329afe331703210360313 Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Sat, 29 Dec 2012 18:03:42 +0200 Subject: [PATCH] Rename Events#oneTimeListenTo to Events#listenToOnce --- backbone.js | 12 +----------- test/events.js | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/backbone.js b/backbone.js index 6d91afba..6d42b308 100644 --- a/backbone.js +++ b/backbone.js @@ -189,16 +189,6 @@ return this; }, - // An inversion-of-control version of `on`. Tell *this* object to listen to - // an event in another object ... keeping track of what it's listening to. - listenTo: function(obj, name, callback) { - var listeners = this._listeners || (this._listeners = {}); - var id = obj._listenerId || (obj._listenerId = _.uniqueId('l')); - listeners[id] = obj; - obj.on(name, typeof name === 'object' ? this : callback, this); - return this; - }, - // Tell this object to stop listening to either specific events ... or // to every object it's currently listening to. stopListening: function(obj, name, callback) { @@ -223,7 +213,7 @@ // An inversion-of-control versions of `on` and `once`. Tell *this* object to listen to // an event in another object ... keeping track of what it's listening to. _.each(listenMethods, function(eventBinder, method) { - Events[method] = function(object, events, callback) { + Events[method] = function(obj, name, callback) { var listeners = this._listeners || (this._listeners = {}); var id = obj._listenerId || (obj._listenerId = _.uniqueId('l')); listeners[id] = obj; diff --git a/test/events.js b/test/events.js index 338fb4b1..a3496a12 100644 --- a/test/events.js +++ b/test/events.js @@ -432,4 +432,4 @@ $(document).ready(function() { _.extend({}, Backbone.Events).once('event').trigger('event'); }); -}); +}); \ No newline at end of file