lifecycle methods

browser โŸฉ web components โŸฉ implement โŸฉ custom elements โŸฉ lifecycle methods

  • constructor() an instance of custom element is created or upgraded.

  • connectedCallback() custom element is appended into/moved in a document.

  • disconnectedCallback() custom element is removed from the document.

  • attributeChangedCallback(attrName, oldVal, newVal) one of the custom elementโ€™s attributes is added/removed/changed. observed attributes are specified with static get observedAttributes().

  • adoptedCallback() custom element is moved to a new document.

Last updated