mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
25 lines
465 B
JavaScript
25 lines
465 B
JavaScript
import _ from "lodash";
|
|
import { Presence } from "phoenix";
|
|
|
|
class Presences {
|
|
constructor() {
|
|
this.presences = {};
|
|
}
|
|
|
|
syncState(data) {
|
|
this.presences = Presence.syncState(this.presences, data);
|
|
}
|
|
|
|
syncDiff(data) {
|
|
this.presences = Presence.syncDiff(this.presences, data);
|
|
}
|
|
|
|
opponentOnline(opponentId) {
|
|
return _.find(this.presences, (value, id) => {
|
|
return parseInt(id) == opponentId;
|
|
});
|
|
}
|
|
}
|
|
|
|
export default Presences;
|