UNPKG

generator-backed-element

Version:
43 lines (40 loc) 883 B
<template id="<%= name %>"> <style> :host { display: flex; } </style> <slot></slot> </template> <script> 'use strict'; /** * A trying to be useful element! * @extends HTMLElement * * * Info about callbacks can be found at * https://github.com/VandeurenGlenn/backed/wiki/Lifecycle-callback-methods */ Backed(class <%= className %> extends HTMLElement { /** * Element has been created (upgraded) */ created() { // Useful for initializing state, settings up event listeners, etc // When not using backed, you would setup shadow dom here also. } /** * Element has been inserted into the DOM. */ connected() { // shadowRoot, pusbSub, fireEvent, toJsProp etc are ready to use ... } /** * Element is ready to ROCK! */ ready() { // this is where you start using your properties, observers, etc } }); </script>