kanna

0.0.5 • Public • Published

kanna -- A simple, composable Framework

install

   npm install kanna

usage

  • create HTMLElement
   const {k, mount} = require('kanna');
   mount(document.body, k('h1', {}, ['title']));
  • component
const {k, V, mount} = require('kanna');
const comp = V(({
    props
    }) => {
    return k('h1', {}, [props.text]);
});
mount(document.body, k(comp, {
     text: 'hello'
}));
  • update data
 function getData() {
     return Promise.resolve({
         text: 'kino'
     });
 }
 const comp = V(({
     props,
 }) => {
     return k('h1', {}, [props.text]);
 }, {
     mounted: ({
         props
     }, {
         update
     }) => {
         getData().then(data => {
             update('text', data.text);
         });
     }
 });
 
 mount(document.body, k(comp, {
     text: ''
 }, []));
 

test

  • unit test
npm test
  • run example web
npm run server

Readme

Keywords

Package Sidebar

Install

npm i kanna

Weekly Downloads

3

Version

0.0.5

License

ISC

Unpacked Size

102 kB

Total Files

19

Last publish

Collaborators

  • hongxuanlee