0.0.1 • Published 5 years ago

web-component-abstract v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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