I have the following code:
context
.on( 'hangup', this.handleHangup );
In the class constructor and
PlayMessage.prototype.handleHangup = function() {
log.callout.info( "Call [%s]: Client hungup.", this.row.get( 'id' ) );
this.endCall(); // Get out of here
}
As a function to the class. The class is called PlayMessage.
I get an error saying:
events.js:130 throw TypeError('listener must be a function');
Talking about the context.on( ... ) line I pasted above.
How should I be using the class function as a listener?
thiskeyword when you callcontext.on( 'hangup', this.handleHangup );?