react-rv
Version:
react-rv is a lightweight and efficient state management library for React that allows you to create reactive variables and subscribe to them with minimal overhead.
2 lines • 939 B
JavaScript
;var f=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var x=(e,n)=>{for(var o in n)f(e,o,{get:n[o],enumerable:!0})},O=(e,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of v(n))!y.call(e,t)&&t!==o&&f(e,t,{get:()=>n[t],enumerable:!(r=q(n,t))||r.enumerable});return e};var E=e=>O(f({},"__esModule",{value:!0}),e);var F={};x(F,{rv:()=>s,useRv:()=>d});module.exports=E(F);var c=(e,n)=>e===n;function s(e,n){let{eq:o=c,on:r}=n??{},t=new Set;r&&t.add(r);let u=(...p)=>{if(p.length===0)return e;let[i,T]=p,R=o;if(typeof T?.eq<"u"&&(R=T.eq===!1?c:T.eq),R(e,i))return e;let m=e;return e=i,t.forEach(a=>a(i,m)),e};return u.on=p=>(t.add(p),()=>{t.delete(p)}),u}s.fn=(e,n)=>s(e(),n);var l=require("use-sync-external-store/shim"),d=e=>(0,l.useSyncExternalStore)(e.on,e,e);0&&(module.exports={rv,useRv});
//# sourceMappingURL=index.cjs.map