index.js
function simpleComponent(elementName, elementClass, elementClassToExtend) {
    elementClass = elementClass || {}
    elementClassToExtend = elementClassToExtend || HTMLElement

    elementClass.prototype = Object.create(elementClassToExtend.prototype)
    assign(elementClass.prototype, elementClass)
    elementClass.__template = template(elementName)

    if (elementClass.prototype.createdCallback) {
      elementClass.prototype.__originalCreatedCallback = elementClass.prototype.createdCallback
    }

    elementClass.prototype.createdCallback = function() {
      fill(this, elementClass.__template)
      if (elementClass.prototype.__originalCreatedCallback) {
        elementClass.prototype.__originalCreatedCallback.call(this)
      }
    }

    document.registerElement(elementName, elementClass)
  }
function simpleComponent(elementName, elementClass, elementClassToExtend) {
    elementClass = elementClass || {}
    elementClassToExtend = elementClassToExtend || HTMLElement

    elementClass.prototype = Object.create(elementClassToExtend.prototype)
    assign(elementClass.prototype, elementClass)
    elementClass.__template = template(elementName)

    if (elementClass.prototype.createdCallback) {
      elementClass.prototype.__originalCreatedCallback = elementClass.prototype.createdCallback
    }

    elementClass.prototype.createdCallback = function() {
      fill(this, elementClass.__template)
      if (elementClass.prototype.__originalCreatedCallback) {
        elementClass.prototype.__originalCreatedCallback.call(this)
      }
    }

    document.registerElement(elementName, elementClass)
  }
function simpleComponent ( elementName , elementClass , elementClassToExtend ) { elementClass = elementClass || { } elementClassToExtend = elementClassToExtend || HTMLElement elementClass . prototype = Object . create ( elementClassToExtend . prototype ) assign ( elementClass . prototype , elementClass ) elementClass . __template = template ( elementName ) if ( elementClass . prototype . createdCallback ) { elementClass . prototype . __originalCreatedCallback = elementClass . prototype . createdCallback } elementClass . prototype . createdCallback = function ( ) { fill ( this , elementClass . __template ) if ( elementClass . prototype . __originalCreatedCallback ) { elementClass . prototype . __originalCreatedCallback . call ( this ) } } document . registerElement ( elementName , elementClass ) }
Define a stateless custom element with no behaviors.
Give the element's template an ID attribute with the "-template" suffix.
@module simpleComponent
@example
<template id="simple-bling-template">
<style>
simple-bling {
color: gold;
font-weight: bold;
}
</style>
</template>
<script>
simpleComponent('simple-bling')
</script>
@param {String} elementName Name of the custom element
@param {Object} [elementClass] An object with lifecycle callbacks on it. Not actually an ES6 class for compatability purposes.
@param {Function} [elementClassToExtend] An existing HTML element class to extend, e.g. HTMLButtonElement.
@return {void}
Define a stateless custom element with no behaviors . Give the element s template an ID attribute with the - template suffix .