39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
|
import * as plugins from './dees-element.plugins';
|
||
|
|
||
|
export class DeesElement extends plugins.litElement.LitElement {
|
||
|
// INSTANCE
|
||
|
@plugins.litElement.property({ type: Boolean })
|
||
|
public goBright: boolean = false;
|
||
|
|
||
|
// domtools
|
||
|
public domtoolsPromise = plugins.domtools.elementBasic.setup(this);
|
||
|
|
||
|
@plugins.litElement.property()
|
||
|
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'));
|
||
|
}
|
||
|
}
|