0.1.14 • Published 4 years ago

jquery-ts-components v0.1.14

Weekly downloads
11
License
MIT
Repository
github
Last release
4 years ago

jQuery TypeScript Components

npm install --save jquery-ts-components

Simple jQuery TypeScript component system.

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

interface HelloOptions
{
    text?: string;
}

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

    public constructor(element: JQuery | JQuery.Selector | HTMLElement, options: HelloOptions = {})    {
        this.$element = $(element);
        this.$element.text(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="//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="index.js"></script>
</body>
</html>
// index.ts
import {register} from 'jquery-ts-components';
import 'Hello';

register(document.body);
0.1.11

4 years ago

0.1.12

4 years ago

0.1.13

4 years ago

0.1.14

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

5 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago