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

50 lines
1.6 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 16:32:48 +00:00
// Module ID: 13967
// Function ID: 13968
// Name: LocalPresenceStateManager
2026-10-12 16:32:48 +00:00
// Dependencies: [5759, 13968, 13969, 2]
2026-10-12 16:32:48 +00:00
// Module 13967 (LocalPresenceStateManager)
import rateLimitDefault from "rateLimit" /* 13969 */;
import SelfPresenceStore from "SelfPresenceStore" /* 5759 */;
import StateManager from "StateManager" /* 13968 */;
2026-10-01 14:13:23 +00:00
import size from "module_2" /* 2 */;
2026-10-01 14:13:23 +00:00
class LocalPresenceStateManager extends StateManager {
constructor(socket) {
const tmp3 = new LocalPresenceStateManager(false, tmp2, tmp, new.target, this);
tmp3.switchingAccounts = false;
2026-10-01 14:13:23 +00:00
const emitPresenceUpdate = tmp3.emitPresenceUpdate;
const tmp4 = rateLimitDefault;
tmp3.didCommit = tmp4(5, 20000, emitPresenceUpdate.bind(tmp3));
2026-10-01 14:13:23 +00:00
tmp3.socket = socket;
return tmp3;
}
2026-10-01 14:13:23 +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());
}
}
const prototype = LocalPresenceStateManager.prototype;
const result = size.fileFinishedImporting("modules/gateway/LocalPresenceStateManager.tsx");
export default LocalPresenceStateManager;