decord/alpha/source/modules/gateway/LocalPresenceStateManager.tsx

50 lines
1.6 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 13891
// Function ID: 13892
// Name: LocalPresenceStateManager
2026-10-09 10:00:15 +00:00
// Dependencies: [5756, 13892, 13893, 2]
2026-07-23 10:11:24 +00:00
2026-10-09 10:00:15 +00:00
// Module 13891 (LocalPresenceStateManager)
import rateLimitDefault from "rateLimit" /* 13893 */;
import SelfPresenceStore from "SelfPresenceStore" /* 5756 */;
import StateManager from "StateManager" /* 13892 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
class LocalPresenceStateManager extends StateManager {
constructor(socket) {
const tmp3 = new LocalPresenceStateManager(false, tmp2, tmp, new.target, this);
2026-07-29 08:29:29 +00:00
tmp3.switchingAccounts = false;
2026-10-03 08:58:59 +00:00
const emitPresenceUpdate = tmp3.emitPresenceUpdate;
const tmp4 = rateLimitDefault;
tmp3.didCommit = tmp4(5, 20000, emitPresenceUpdate.bind(tmp3));
2026-10-03 08:58:59 +00:00
tmp3.socket = socket;
2026-07-29 08:29:29 +00:00
return tmp3;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
getInitialState() {
return SelfPresenceStore.getLocalPresence();
}
getNextState() {
return SelfPresenceStore.getLocalPresence();
}
shouldCommit() {
const socket = this.socket;
return socket.isSessionEstablished();
}
emitPresenceUpdate(state) {
const socket = this.socket;
socket.presenceUpdate(state.status, state.since, state.activities, state.afk);
}
handleConnectionOpen() {
this.update({}, !this.switchingAccounts);
this.switchingAccounts = false;
}
handleAccountSwitch() {
this.switchingAccounts = true;
this.reset();
this.emitPresenceUpdate(this.getState());
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = LocalPresenceStateManager.prototype;
const result = size.fileFinishedImporting("modules/gateway/LocalPresenceStateManager.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default LocalPresenceStateManager;