Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handlePresenceDiff = (diff) => {
console.log('presence_diff', diff);
const oldPresence = this.stateBuffer.presence;
const syncedPresence = Presence.syncDiff(oldPresence, diff);
this.updateState({ presence: { $set: syncedPresence } });
const handleJoins = joins => Object.keys(joins).forEach(this.handleJoin);
const handleLeaves = leaves => Object.keys(leaves).forEach(this.handleLeave);
handleJoins(diff.joins);
handleLeaves(diff.leaves);
};
interfaceChannel.on('presence_diff', diff => {
presences = Presence.syncDiff(presences, diff)
dispatch(updatePresences(Presence.list(presences, listBy)))
})
room.on("presence_diff", diff => {
presences = Presence.syncDiff(presences, diff)
const users = values(presences).map(presence => presence.user)
this.setState({ users })
})
channel.on('presence_diff', (diff) => {
presences = Presence.syncDiff(presences, diff);
syncPresentUsers(dispatch, presences);
});
channel.on('presence_diff', (diff) => {
presences = Presence.syncDiff(presences, diff)
store.dispatch('syncPresentUsers', presences)
})
this.channel.on("presence_diff", diff => {
this.setState({
...this.state,
presences: Presence.syncDiff(this.state.presences, diff)
});
});