This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { html, render } from 'lit-html'; | |
export default class ComponentClass extends HTMLElement { | |
constructor() { | |
super(); | |
// set sane defaults if desired. | |
this._value = null; | |
} | |
get values() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Factory to take some of the boilerplate out of creating constructors | |
* which instantiate objects even without the new keyword. | |
* @param {function} fn - Input function to create constructor from. | |
* @returns The updated constructor. | |
*/ | |
function constructorFactory(fn) { | |
if (typeof fn !== 'function') { | |
throw new TypeError('Expected function!'); | |
} |