Skip to content
Snippets Groups Projects
Commit 710977f5 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Add methods for when an activity gets added and removed (cleanup)

parent 062d4eb6
No related branches found
No related tags found
No related merge requests found
......@@ -626,24 +626,29 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
if (this._lastElm.tagName.toLowerCase() == activity.element.toLowerCase()) {
return this._lastElm;
} else {
this._attrObserver.disconnect();
this._onActivityRemoved(this._lastElm);
this._lastElm = undefined;
}
}
const elm = document.createElement(activity.element);
this._onActivityAdded(elm);
this._lastElm = elm;
return elm;
}
_onActivityAdded(element) {
for(const key of this.topic.attributes || []) {
let value = sessionStorage.getItem('vpu-attr-' + key);
if (value !== null) {
elm.setAttribute(key, value);
element.setAttribute(key, value);
}
}
this._attrObserver.observe(element, {attributes: true, attributeFilter: this.topic.attributes});
}
this._attrObserver.observe(elm, {attributes: true, attributeFilter: this.topic.attributes});
this._lastElm = elm;
return elm;
_onActivityRemoved(element) {
this._attrObserver.disconnect();
}
_renderActivity() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment