import { RuntimeStore } from 'ontime-types'; import { socket } from '../adapters/WebsocketAdapter.js'; const store: Partial = {}; /** * A runtime store that broadcasts its payload */ export const eventStore = { get(key: T) { return store[key]; }, set(key: T, value: RuntimeStore[T]) { store[key] = value; // TODO: Partial updates seems to cause issues on the client // socket.send({ // type: `ontime-${key}`, // payload: value, // }); this.broadcast(); }, poll() { return store; }, broadcast() { socket.send({ type: 'ontime', payload: store, }); }, };