_events[name].unshift() not compatible with nodejs EventEmitter; use .prependListener()

This commit is contained in:
Lamp 2018-12-14 06:07:35 +00:00
parent d9de1324ec
commit a1aa5f0154
1 changed files with 2 additions and 4 deletions

View File

@ -180,9 +180,7 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site =
// announce join/leave/rename
gClient._events.p = gClient._events.p || [];
gClient._events.bye = gClient._events.bye || [];
gClient._events.p.unshift(async participant => {
gClient.prependListener("p", async participant => {
if (gClient.ppl[participant.id]) { // is update
let oldName = gClient.ppl[participant.id].name, newName = participant.name;
if (newName != oldName)
@ -191,7 +189,7 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site =
dSend(`\`${participant._id.substr(0,6)}\` ___**${sanitizeName(participant.name)}** entered the room.___`);
}
});
gClient._events.bye.unshift(async msg => {
gClient.prependListener("bye", async msg => {
var participant = MPP.client.ppl[msg.p];
dSend(`\`${participant._id.substr(0,6)}\` ___**${sanitizeName(participant.name)}** left the room.___`);
});