UNPKG

413 BJavaScriptView Raw
1function createBroadcast(t){var e={},r=1,n=t;return{getState:function(){return n},setState:function(t){n=t;for(var r=Object.keys(e),o=0,u=r.length;o<u;o++)e[r[o]]&&e[r[o]](t)},subscribe:function(t){if("function"!=typeof t)throw new Error("listener must be a function.");var n=r;return e[n]=t,r+=1,n},unsubscribe:function(t){delete e[t]}}}module.exports=createBroadcast;
2//# sourceMappingURL=brcast.cjs.min.js.map