javascriptvline

vline im:recv event error: Uncaught TypeError: Cannot call method 'log' of undefined in vline.js


When receiving a vLine im, I experience an uncaught TypeError.

Set up the event handler:

this.client_.on('recv:im', this.onMessageRecv, this);

onMessageRecv is:

function (aEvent) {
      var msg = event.message;
      var sender = msg.getSender();

      this.displayError(sender.getDisplayName(),
                        sender.getThumbnailUrl(),
                        msg.getBody());
}

(displayError is merely calling alert)

Not sure if this is helpful or not, but here is a screengrab of the debugger: https://i.sstatic.net/PkXrT.png


Solution

  • It looks like you're passing the event argument with the name aEvent and then attempting to reference it as event.message instead of aEvent.message.