muryshev's picture
update
9923f3d
raw
history blame contribute delete
509 Bytes
import{n as c,b as l}from"./scheduler.5WtVptCO.js";const n=[];function h(e,o){return{subscribe:p(e,o).subscribe}}function p(e,o=c){let r;const i=new Set;function u(t){if(l(e,t)&&(e=t,r)){const b=!n.length;for(const s of i)s[1](),n.push(s,e);if(b){for(let s=0;s<n.length;s+=2)n[s][0](n[s+1]);n.length=0}}}function f(t){u(t(e))}function a(t,b=c){const s=[t,b];return i.add(s),i.size===1&&(r=o(u,f)||c),t(e),()=>{i.delete(s),i.size===0&&r&&(r(),r=null)}}return{set:u,update:f,subscribe:a}}export{h as r,p as w};