Class IYYChannelChat
Extends
IYYCommon.
公屏聊天和私聊接口。接受公屏聊天消息和私聊消息。
Defined in: yyapi.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
IYYChannelChat 构造函数。
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
IYYChannelChat.CHAT
在频道中收到公屏聊天消息。当有用户在公屏上输入聊天信息的时候会触发。
|
| <static> |
IYYChannelChat.CHAT_FROM
在频道中收到私聊消息。当收到其他用户发送过来的私聊消息的时候触发。
|
- Methods borrowed from class IYYCommon:
- addEventListener, removeEventListener
Field Detail
<static>
IYYChannelChat.CHAT
在频道中收到公屏聊天消息。当有用户在公屏上输入聊天信息的时候会触发。
侦听函数格式: function(eventData){ }
侦听函数参数说明:
eventData.uid: Number类型,发送公屏消息的用户的uid。
eventData.msg: String类型,发送公屏消息的文字内容。
使用示例:
yy.channel.chat.addEventListener(IYYChannelChat.CHAT,onChannelChat);
function onChannelChat(eventData)
{
document.getElementById("txtLog").innerHTML="收到来自uid="+eventData.uid+"的公屏聊天消息msg="+eventData.msg;
}
<static>
IYYChannelChat.CHAT_FROM
在频道中收到私聊消息。当收到其他用户发送过来的私聊消息的时候触发。
侦听函数格式: function(eventData){ }
侦听函数参数说明:
eventData.uid: Number类型,发送私聊消息的用户的uid。
eventData.msg: String类型,发送私聊消息的文字内容。
使用示例:
yy.channel.chat.addEventListener(IYYChannelChat.CHAT_FROM,onChannelChatFrom);
function onChannelChatFrom(eventData)
{
document.getElementById("txtLog").innerHTML="收到来自uid="+eventData.uid+"的私聊消息msg="+eventData.msg;
}