on method

void on(
  1. String eventType,
  2. Function handler
)

Used to listen to TalkJS session events

@remarks A "message" event is fired every time a message is sent or received by the current user (even if no TalkJS UI is visible). Your handler function is passed a {@link Message} object with some information about each message and its conversation.

For an example, see {@link https://gist.github.com/eteeselink/607e585eb40be76f2ed150d4090e5261}

Related method: {@link Session.off | Session.off}

Implementation

external void on(String eventType, Function handler);