0.1.3 • Published 6 years ago

vanio-ts-components v0.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

TypeScript Components

License

npm install --save vanio-ts-components

Simple TypeScript component system.

// Hello.ts
import {component} from 'vanio-ts-components';

interface HelloOptions
{
    text?: string;
}

@component('HelloComponent')
export default class Hello
{
    private element: HTMLElement;

    public constructor(element: HTMLElement, options: HelloOptions = {})
    {
        this.element = element;
        this.element.innerText = options.text || 'Hello';
    }
}
<!doctype html>
<html lang="en">
<head>
    <meta charset=utf-8>
</head>
<body>
    <p data-component-hello-component='{"text": "Hello world!"}'></p>
    <script src="index.js"></script>
</body>
</html>
// index.ts
import {register} from 'vanio-ts-components';
import 'Hello';

register(document.body);
0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago