x-tag / core

The Heart of X-Tag

Home Page:http://x-tag.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Migration guide || equivalents of inserted/...?

Janiczek opened this issue · comments

Hello!
We're being nudged by Chrome warnings to stop using 1.5.11 and go for something newer:

[Deprecation] document.registerElement is deprecated and will be removed in M73, around March 2019. Please use window.customElements.define instead. See https://www.chromestatus.com/features/4642138092470272 for more details.

When trying to migrate our v1 components to v2, we hit a roadblock: how to represent the inserted and removed lifecycle hooks? They don't seem to have support in v2.
(Whatever answer will this have, it would be nice to write it in the actual docs.)

For future Us:
X-tag v2 is using native callbacks for WebComponents

it means you can simply do something like

xtag.create('x-frank', class extends XTagElement {
  connectedCallback() { 
    //replacemend for inserted hook
  }
  disconnectedCallback() {
    //replacement for removed hook
  }
});

It's not much clear from X-tag V2 docs.