Files
discord-decomp/modules/notifications/friend_online/FriendOnlineTimerStore.tsx
T
2026-11-01 12:12:55 +02:00

33 lines
966 B
TypeScript

// Metro module 16648 (f16649).
import Durations from "../../../utils/Durations";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
const HOUR = Durations.Millis.HOUR;
let c11987_1 = {
lastReportedAtMs: null
};
let c11987_2 = c11987_1;
class FriendOnlineTimerStore extends Module589.PersistedStore {
static displayName = "FriendOnlineTimerStore";
static persistKey = "FriendOnlineTimerStore";
initialize(r2 = c11987_1) {
if (r2 == null) {
r2 = c11987_1;
}
c11987_2 = r2;
}
isCooldownElapsed() {
return c11987_2.lastReportedAtMs == null || Date.now() - c11987_2.lastReportedAtMs >= HOUR;
}
getState() {
return c11987_2;
}
}
const friendOnlineTimerStore = new FriendOnlineTimerStore(Dispatcher, {
FRIEND_ONLINE_TIMER_REPORTED: function setLastReportedAtMs(a0) {
c11987_2.lastReportedAtMs = a0.timestampMs;
return true;
}
});
export default friendOnlineTimerStore;