@rxdi/ui-kit
Version:
UI Components for building graphql-server website
26 lines • 880 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReactiveElement = void 0;
const lit_html_1 = require("@rxdi/lit-html");
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
class ReactiveElement extends lit_html_1.LitElement {
constructor(v) {
super();
this.select = (mapFn) => {
return this.state.pipe((0, operators_1.map)(mapFn));
};
this.setState = (newState) => {
this.state.next(Object.assign(Object.assign({}, this.state.getValue()), newState));
};
this.getState = () => {
return this.state.getValue();
};
this.state = new rxjs_1.BehaviorSubject(v || {});
}
get state$() {
return this.state.asObservable();
}
}
exports.ReactiveElement = ReactiveElement;
//# sourceMappingURL=index.js.map