@exmg/lit-base
Version:
Lit Base Elements for ExMachina
31 lines • 1.05 kB
JavaScript
import { ExmgElement } from './exmg-element.js';
import { getConnectedStore } from './connect.js';
export class ConnectedLitElement extends ExmgElement {
constructor() {
super(...arguments);
this.routeDebug = false;
this.isPage = false;
}
getStore() {
return getConnectedStore();
}
connectedCallback() {
super.connectedCallback();
this.storeUnsubscribe = this.getStore().subscribe(() => {
this.stateChanged(this.getStore().getState());
this._stateChanged && this._stateChanged(this.getStore().getState());
});
this.stateChanged(this.getStore().getState());
this._stateChanged && this._stateChanged(this.getStore().getState());
}
disconnectedCallback() {
this.storeUnsubscribe && this.storeUnsubscribe();
super.disconnectedCallback();
}
stateChanged(state) {
if (this.routeDebug) {
console.log('stateChanged', state);
}
}
}
//# sourceMappingURL=connected-lit-element.js.map