1.1.0 • Published 5 years ago
@latel88/hotate v1.1.0
Hotate
UI library.
install
npm install @latel88/hotate
- CJS
const Hotate = requrire( "@latel88/hotate" ).default;
- ESM
import Hotate from "@latel88/hotate";
exsample
const $ = new Hotate( { window } );
const elem = document.getElementById( "render" );
$.BOOT( elem ).
OPEN( "div",
{
style: {
"color": "#f00"
}
} ).
TEXT( "HelloWorld!" ).
CLOSE( "div" ).
EXIT();
rendering list
const list = [ "apple", "orange", "nuts" ];
const render = ( name ) ->
{
$.OPEN( "li" ).
TEXT( name ).
CLOSE( "li" );
}
$.BOOT( elem );
$.OPEN( "ul",
{
style: {
"listStyleType": "number"
}
} );
list.forEach( render );
$.CLOSE( "ul" );
$.EXIT();
append touch element
const canvas = document.createElement( "canvas" );
const css = elem.style;
canvas.id = "game";
css.width = elem.width * 2 + "px";
css.height = elem.height * 2 + "px";
$.BOOT( elem ).
ELEMENT( canvas ).
EXIT();
$.BOOT( elem ).
VOID( "canvas" ).
EXIT();
console.log( canvas.parentNode ); //null