Skip to content
Snippets Groups Projects
Unverified Commit 0889858e authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Add attributeChangedCallback and fix fucntion call (dbp/apps/authenticdocument#2)

parent edeeaab3
No related branches found
No related tags found
No related merge requests found
Pipeline #15362 passed
......@@ -19,7 +19,7 @@ export class AdapterLitElement extends LitElement {
if (this.deferUnSubscribe) {
const attrs = this.unsubscribe.split(',');
attrs.forEach(element => this.subscribeProviderFor(element));
attrs.forEach(element => this.unSubscribeProviderFor(element));
this.deferSubscribe = false;
this.unsubscribe = '';
}
......@@ -76,31 +76,61 @@ export class AdapterLitElement extends LitElement {
};
}
update(changedProperties) {
changedProperties.forEach((oldValue, propName) => {
switch(propName) {
case 'subscribe':
if (this.subscribe && this.subscribe.length > 0) {
if (this.connected) {
const attrs = this.subscribe.split(',');
attrs.forEach(element => this.unSubscribeProviderFor(element));
} else {
this.deferUnSubscribe = this.subscribe.length > 0;
this.unsubscribe = this.subscribe;
}
attributeChangedCallback(name, oldValue, newValue) {
switch(name) {
case 'subscribe':
console.log('AdapterLitElement() attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
if (this.subscribe && this.subscribe.length > 0) {
if (this.connected) {
const attrs = this.subscribe.split(',');
attrs.forEach(element => this.unSubscribeProviderFor(element));
} else {
this.deferUnSubscribe = this.subscribe.length > 0;
this.unsubscribe = this.subscribe;
}
if (this.subscribe !== null) {
if (this.connected) {
const attrs = this.subscribe.split(',');
attrs.forEach(element => this.subscribeProviderFor(element));
} else {
this.deferSubscribe = this.subscribe && this.subscribe.length > 0;
}
}
if (newValue !== null) {
this.subscribe = newValue;
if (this.connected) {
const attrs = newValue.split(',');
attrs.forEach(element => this.subscribeProviderFor(element));
} else {
this.deferSubscribe = newValue && newValue.length > 0;
}
break;
}
});
}
break;
}
super.update(changedProperties);
super.attributeChangedCallback(name, oldValue, newValue);
}
// update(changedProperties) {
// changedProperties.forEach((oldValue, propName) => {
// switch(propName) {
// case 'subscribe':
// if (this.subscribe && this.subscribe.length > 0) {
// if (this.connected) {
// const attrs = this.subscribe.split(',');
// attrs.forEach(element => this.unSubscribeProviderFor(element));
// } else {
// this.deferUnSubscribe = this.subscribe.length > 0;
// this.unsubscribe = this.subscribe;
// }
// }
// if (this.subscribe !== null) {
// if (this.connected) {
// const attrs = this.subscribe.split(',');
// attrs.forEach(element => this.subscribeProviderFor(element));
// } else {
// this.deferSubscribe = this.subscribe && this.subscribe.length > 0;
// }
// }
// break;
// }
// });
//
// super.update(changedProperties);
// }
}
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