Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. class MyComponent extends HTMLElement {
  2. constructor() {
  3. super();
  4. this.attachShadow({'mode': 'open'});
  5. }
  6. connectedCallback() {
  7. //Executed when the element is added to the DOM
  8. this.shadowRoot.innerHTML = `<p>This is my component!</p>`;
  9. }
  10. static get observedAttributes() { return []; }
  11. attributeChangedCallback(name, oldValue, newValue) {
  12. //Observe attribute changes
  13. }
  14. disconnectedCallback() {
  15. //Executed when the element is removed from the DOM
  16. }
  17. }
  18.  
  19. customElements.define("my-component", MyComponent);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement