Files
tiny-worlds/web/state.mjs
T

18 lines
684 B
JavaScript

// web/state.mjs -- the shared runtime state.
//
// Deliberately small: auth (me), the render sequence (seq -- the
// async race guard; a view captures it at enter and checks it after
// every await), and the currently addressed run (runId -- setup and
// play both write here; saves address it). Everything else is
// module-local to the view or widget that owns it.
/** @typedef {import('../server/shapes.mjs').User} User */
/** @type {{ view: ?string, seq: number, me: ?User, runId: ?string }} */
export const state = {
view: null, // the active view name ('claim' | 'home' | ...)
seq: 0,
me: null, // the signed-in user ({ id, name, superuser }) or null
runId: null,
};