UNPKG

@zag-js/store

Version:

The reactive store package for zag machines

19 lines (18 loc) 491 B
// src/global.ts function glob() { if (typeof globalThis !== "undefined") return globalThis; if (typeof self !== "undefined") return self; if (typeof window !== "undefined") return window; if (typeof global !== "undefined") return global; } function globalRef(key, value) { const g = glob(); if (!g) return value(); g[key] || (g[key] = value()); return g[key]; } var refSet = globalRef("__zag__refSet", () => /* @__PURE__ */ new WeakSet()); export { globalRef, refSet };