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

StackOverflow https://stackoverflow.com/questions/19599262

  •  01-07-2022
  •  | 
  •  

Question

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: http://i.imgur.com/iGCn2dt.png

Was it helpful?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top