UNPKG

rwsdk

Version:

Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime

14 lines (13 loc) 288 B
const state = {}; export function defineRwState(key, initializer) { if (!(key in state)) { state[key] = initializer(); } return state[key]; } export function getRwState(key) { return state[key]; } export function setRwState(key, value) { state[key] = value; }