0.0.3 • Published 9 months ago

@levinelito/base-component v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Simple Base Class for Web Component

Usage

class MyInfo extends BaseComponent {
    static observedAttributes = ['name', 'height'];
    Attributes = {
        name : {
            required    : true,
            type        : 'string'
        },
        height : { type : 'integer' }
    }
    
    _render() {
        this.innerHTML = '<div>';
        this.innerHTML += `My name is ${this.getValue('name')}.`;
        this.innerHTML += `I'm ${this.getValue('height')} cm tall.`;
        this.innerHTML += '</div>';
    }
}
customElements.define('my-info', MyInfo);
<my-info name="Levine" height="170"></my-info>
0.0.3

9 months ago

0.0.2

2 years ago

0.0.1

2 years ago