qFelix's picture
Brad Did Something - Gradio/FastAPI Space on HF
78c0f6e
Raw
History Blame Contribute Delete
1.08 kB
// shared client state — the server snapshot plus client-only bookkeeping
export const G = {
sessionId: null,
state: null, // latest server snapshot (client-safe, no hidden stats)
phase: "title", // mirrors server phase + client-side nuance
busy: false, // a network call is in flight
pendingEvent: null, // fetched event waiting for the player to walk over
roamTimer: 0, // seconds until next event fires
telegraphed: false,
dialogueOpen: false,
els: {},
};
export function cacheEls() {
for (const id of ["stage", "floor", "world", "fx", "boardroom", "dim",
"flash", "edge-pulse", "wipe", "stamp", "hud", "dialogue",
"gift-panel", "title-screen", "review-screen", "pt-entries",
"rev-number", "rev-fill", "boss-title", "crisis-counter",
"pocket", "hr-badge", "hud-banner", "stage-wrap", "comic"]) {
G.els[id] = document.getElementById(id);
}
}
export function setState(snapshot) {
G.state = snapshot;
G.phase = snapshot.phase;
}