UNPKG

fui-fancyui

Version:
15 lines (14 loc) 513 B
const S = (s) => { let t; const o = /* @__PURE__ */ new Set(), c = (e, r) => { const n = typeof e == "function" ? e(t) : e; if (!Object.is(n, t)) { const b = t; t = r ?? (typeof n != "object" || n === null) ? n : Object.assign({}, t, n), o.forEach((l) => l(t, b)); } }, i = () => t, a = { setState: c, getState: i, getInitialState: () => u, subscribe: (e) => (o.add(e), () => o.delete(e)) }, u = t = s(c, i, a); return a; }, d = (s) => s ? S(s) : S; export { d as createStore };