lifecycle methods

browserweb componentsimplementcustom 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