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 { ...@@ -19,7 +19,7 @@ export class AdapterLitElement extends LitElement {
if (this.deferUnSubscribe) { if (this.deferUnSubscribe) {
const attrs = this.unsubscribe.split(','); const attrs = this.unsubscribe.split(',');
attrs.forEach(element => this.subscribeProviderFor(element)); attrs.forEach(element => this.unSubscribeProviderFor(element));
this.deferSubscribe = false; this.deferSubscribe = false;
this.unsubscribe = ''; this.unsubscribe = '';
} }
...@@ -76,31 +76,61 @@ export class AdapterLitElement extends LitElement { ...@@ -76,31 +76,61 @@ export class AdapterLitElement extends LitElement {
}; };
} }
update(changedProperties) { attributeChangedCallback(name, oldValue, newValue) {
changedProperties.forEach((oldValue, propName) => { switch(name) {
switch(propName) { case 'subscribe':
case 'subscribe': console.log('AdapterLitElement() attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
if (this.subscribe && this.subscribe.length > 0) {
if (this.connected) { if (this.subscribe && this.subscribe.length > 0) {
const attrs = this.subscribe.split(','); if (this.connected) {
attrs.forEach(element => this.unSubscribeProviderFor(element)); const attrs = this.subscribe.split(',');
} else { attrs.forEach(element => this.unSubscribeProviderFor(element));
this.deferUnSubscribe = this.subscribe.length > 0; } else {
this.unsubscribe = this.subscribe; this.deferUnSubscribe = this.subscribe.length > 0;
} this.unsubscribe = this.subscribe;
} }
if (this.subscribe !== null) { }
if (this.connected) {
const attrs = this.subscribe.split(','); if (newValue !== null) {
attrs.forEach(element => this.subscribeProviderFor(element)); this.subscribe = newValue;
} else { if (this.connected) {
this.deferSubscribe = this.subscribe && this.subscribe.length > 0; 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