web-component-abstract
v0.0.1
Published
Abstract class for creating web components
Downloads
1
Readme
web-component-abstract
Abstract class for creating web components with attributes bound to state.
Install
npm install --save web-component-abstract
Usage
JavaScript:
const Component = require("web-component-abstract");
class Hello extends Component({name: "World"}) {
styles() {
return "./style.css";
}
render() {
const element = document.createElement("div");
element.textContent = `Hello ${this.state.name}`;
return element;
}
}
Hello.define("my-hello");
HTML:
<my-hello name="Web Components"></my-hello>
Output: Hello Web Components