Avoid local variable name `self' in eventlistener.js

refs #10703
This commit is contained in:
Alexander A. Klimov 2016-09-01 16:02:13 +02:00
parent 060a82fa4a
commit 4e2c626ae0

View File

@ -41,14 +41,14 @@
* 'on' to register listeners * 'on' to register listeners
*/ */
EventListener.prototype.bind = function (emitter) { EventListener.prototype.bind = function (emitter) {
var self = this; var _this = this;
$.each(this.handlers, function(i, handler) { $.each(this.handlers, function(i, handler) {
self.icinga.logger.debug('bind: ' + handler.evt + '(' + handler.cond + ')'); _this.icinga.logger.debug('bind: ' + handler.evt + '(' + handler.cond + ')');
emitter.on( emitter.on(
handler.evt, handler.cond, handler.evt, handler.cond,
{ {
self: handler.scope || emitter, self: handler.scope || emitter,
icinga: self.icinga icinga: _this.icinga
}, handler.fn }, handler.fn
); );
}); });
@ -61,9 +61,9 @@
* 'off' to un-register listeners. * 'off' to un-register listeners.
*/ */
EventListener.prototype.unbind = function (emitter) { EventListener.prototype.unbind = function (emitter) {
var self = this; var _this = this;
$.each(this.handlers, function(i, handler) { $.each(this.handlers, function(i, handler) {
self.icinga.logger.debug('unbind: ' + handler.evt + '(' + handler.cond + ')'); _this.icinga.logger.debug('unbind: ' + handler.evt + '(' + handler.cond + ')');
emitter.off(handler.evt, handler.cond, handler.fn); emitter.off(handler.evt, handler.cond, handler.fn);
}); });
}; };