From 176c8738309f5ee3b4aad9c7f67d794b43b37918 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 15 Jan 2014 14:47:51 +0100 Subject: [PATCH] Use opt_this instead of opt_scope in ol.Observable --- src/ol/observable.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/ol/observable.js b/src/ol/observable.js index 5b20280df6..c3d51b1d24 100644 --- a/src/ol/observable.js +++ b/src/ol/observable.js @@ -25,13 +25,12 @@ goog.inherits(ol.Observable, goog.events.EventTarget); * Listen for a certain type of event. * @param {string|Array.} type The event type or array of event types. * @param {function(?): ?} listener The listener function. - * @param {Object=} opt_scope Object is whose scope to call - * the listener. + * @param {Object=} opt_this The object to use as `this` in `listener`. * @return {goog.events.Key} Unique key for the listener. * @todo stability experimental */ -ol.Observable.prototype.on = function(type, listener, opt_scope) { - return goog.events.listen(this, type, listener, false, opt_scope); +ol.Observable.prototype.on = function(type, listener, opt_this) { + return goog.events.listen(this, type, listener, false, opt_this); }; @@ -39,13 +38,12 @@ ol.Observable.prototype.on = function(type, listener, opt_scope) { * Listen once for a certain type of event. * @param {string|Array.} type The event type or array of event types. * @param {function(?): ?} listener The listener function. - * @param {Object=} opt_scope Object is whose scope to call - * the listener. + * @param {Object=} opt_this The object to use as `this` in `listener`. * @return {goog.events.Key} Unique key for the listener. * @todo stability experimental */ -ol.Observable.prototype.once = function(type, listener, opt_scope) { - return goog.events.listenOnce(this, type, listener, false, opt_scope); +ol.Observable.prototype.once = function(type, listener, opt_this) { + return goog.events.listenOnce(this, type, listener, false, opt_this); }; @@ -53,12 +51,11 @@ ol.Observable.prototype.once = function(type, listener, opt_scope) { * Unlisten for a certain type of event. * @param {string|Array.} type The event type or array of event types. * @param {function(?): ?} listener The listener function. - * @param {Object=} opt_scope Object is whose scope to call - * the listener. + * @param {Object=} opt_this The object to use as `this` in `listener`. * @todo stability experimental */ -ol.Observable.prototype.un = function(type, listener, opt_scope) { - goog.events.unlisten(this, type, listener, false, opt_scope); +ol.Observable.prototype.un = function(type, listener, opt_this) { + goog.events.unlisten(this, type, listener, false, opt_this); };