Skip to content

Commit

Permalink
Add componentDidInit
Browse files Browse the repository at this point in the history
  • Loading branch information
nizniz187 committed Sep 12, 2021
1 parent a2fc134 commit e0dc79c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions wc/WComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class WComponent extends HTMLElement{
this.attachShadow({ mode: 'open' });
this.setStylesheet(this.stylesheet);
this.init();
this.componentDidInit();
}
/**
* Call update method in attribute changed callback if attribute name is acceptable
Expand All @@ -28,6 +29,9 @@ class WComponent extends HTMLElement{
this.update({name, oldValue, newValue});
}
}
componentDidInit() {
//this.tabIndex = '0'; // Make component focusable
}
update(){}
/**
* Dynamically create getters & setters for property-attribute sync
Expand Down
1 change: 0 additions & 1 deletion wc/components/checkable/Checkable.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class Checkable extends WComponent{
}

update({ name, oldValue, newValue } = {}) {
console.log(name, oldValue, newValue); // called right after init because first-added attribute will trigger attributeChangedCallback
if(name === this.constructor.attributes.checked.name
|| name === this.constructor.attributes.disabled.name) {
const input = this.shadowRoot.querySelector('input');
Expand Down

0 comments on commit e0dc79c

Please sign in to comment.