blastoise/state.ts

15 lines
402 B
TypeScript

import type { ServerWebSocket } from "bun";
import { Channel, type WsData } from "./channel";
import { Library } from "./library";
// Shared application state
export const state = {
channels: new Map<string, Channel>(),
userConnections: new Map<number, Set<ServerWebSocket<WsData>>>(),
library: null as unknown as Library,
};
export function setLibrary(lib: Library) {
state.library = lib;
}