sea-js-ui-core
Version:
The smallest UI framework
3 lines (2 loc) • 586 B
JavaScript
;Object.defineProperty(exports,"t",{value:!0});var t=require("rxjs");window.store=new class{constructor(e={}){this.state=new t.BehaviorSubject(e)}getState(){return this.state.getValue()}setState(t){const e={...this.state.getValue(),...t};this.state.next(e)}subscribe(t){return this.state.subscribe(t)}},exports.createComponent=function(t,e){function s(){const e=window.store.getState(),s=t(e,window.store.setState.bind(window.store));document.getElementById("root").innerHTML=s}window.store.setState(e),s(),window.store.subscribe(s)};
//# sourceMappingURL=bundle.cjs.js.map