* @returns {this} | * @returns {this} | ||||
*/ | */ | ||||
listen(eventName, callback, owner=null, once=false){ | listen(eventName, callback, owner=null, once=false){ | ||||
if (typeof(callback) !== 'function') | |||||
throw new TypeError("Expected callback argument to be a function or class method."); | |||||
try{ | try{ | ||||
if (!this.is_listening(eventName, callback, owner)){ | if (!this.is_listening(eventName, callback, owner)){ | ||||
if (!this.__listeners.hasOwnProperty(eventName)){ | if (!this.__listeners.hasOwnProperty(eventName)){ |