チャットに関するイベントハンドラを登録します。
Syntax:
chat.emitter.on(eventName, listener);
Arguments:
Name | Type | Required | Default | Description |
---|---|---|---|---|
eventName | String | ○ | 以下の4種類のイベントのリッスンが可能 | |
listener | Function | イベントハンドラ 'unread_message_count_changed'の場合は引数countに未読メッセージ数が渡される |
chat.emitter.on('activate', function(){
console.log('chat activated');
});
chat.emitter.on('deactivate', function(){
console.log('chat deactivated');
});
chat.emitter.on('talk_chat_status_changed', function(data){
console.log('chat status: ', data.chatStatus);
});
chat.emitter.on('unread_message_count_changed', function (count) {
console.log('unread_message_count_changed: ', count)
})