0.7.3 • Published 10 years ago

expanse v0.7.3

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

Expanse

Version License Downloads Downloads

A simple HTML DOM builder based on the native DOM API. Compatible with TypeScript commonjs module resolution.

Install with npm:

npm install --save expanse

Usage

Here's an example how to use the library (in TypeScript):

import { h1, div, a, input } from "expanse";

window.onload = () => {
    console.log("welcome to expanse");

    let title = div().class("title").text("Value:");
    let value = div().class("value");
    let click =  e => {
        e.preventDefault();
        alert("click");
    };
    let link = a().attr("href", "#").text("link").on("click", click);
    let data = input().on("input", e => {
        console.log(e.target["value"]);
    }).val(0);
    let block = div([title, value], link, data).class("block").appendTo(document.body);

    let x = 0;

    console.log(block.css("display"));

    setInterval(() => {
        x++;
        value.text(x.toFixed(0));

        if (x === 10) {
            value.detach();
            title.removeClass();
            link.off("click", click);
        }
    }, 200);
};

License

MIT

0.7.3

10 years ago

0.7.2

10 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.6

10 years ago

0.5.5

10 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago