dees-element/ts/dees-element.classes.dees-element.ts

39 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2021-03-27 16:52:06 +00:00
import * as plugins from './dees-element.plugins';
2021-11-27 16:07:33 +00:00
export class DeesElement extends plugins.lit.LitElement {
2021-03-27 16:52:06 +00:00
// INSTANCE
2021-11-27 16:07:33 +00:00
@plugins.lit.property({ type: Boolean })
2021-03-27 16:52:06 +00:00
public goBright: boolean = false;
// domtools
public domtoolsPromise = plugins.domtools.elementBasic.setup(this);
2021-11-27 16:07:33 +00:00
@plugins.lit.property()
2021-03-27 16:52:06 +00:00
domtools?: plugins.domtools.DomTools;
private themeSubscription: plugins.smartrx.rxjs.Subscription;
constructor() {
super();
this.domtoolsPromise.then((domtoolsArg) => {
this.domtools = domtoolsArg;
});
}
public connectedCallback() {
super.connectedCallback();
this.domtoolsPromise.then(async (domtools) => {
this.themeSubscription = domtools.themeManager.themeObservable.subscribe((goBrightArg) => {
this.goBright = goBrightArg;
});
});
this.dispatchEvent(new CustomEvent('deesElementConnected'));
}
public disconnectedCallback() {
super.disconnectedCallback();
this.themeSubscription.unsubscribe();
this.dispatchEvent(new CustomEvent('deesElementDisconnected'));
}
}