Skip to content

MishmashGroup/halo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Halo! 🖖

Pure and simple render function with hydrating, in ~20 lines of code.

How to run demo:

Install NPM dependencies

npm i

Run dev server

npm run dev

How to use:

Example 1:

See index.html and demo.js source code.

Example 2:

Import as ESM module and run function from HEAD:

    <head>
        <script type="module">
            import {ready, render} from './halo.js';

            const yo = { 
                type: "button",
                children: "Yo!",
                eventHandlers: {
                    click: [
                        () => alert("🖖")
                    ]
                }
            }

            ready(() => {
                render({
                    type: "div",
                    attr: {
                        derp: 42
                    },
                    children: {
                        title: { 
                            type: "h1",
                            children: "Halo! 🖖✨",
                            eventHandlers: {
                                click: [
                                    () => alert("🖖")
                                ]
                            }
                        },
                        buttons: {
                            type: "div",
                            attr: {
                                class: "buttons"
                            },
                            children: {
                                yo,
                                yo2: yo,
                                yo3: yo,
                                yo4: yo,
                                yo5: yo,
                                yo6: yo,
                                yo7: yo
                            }
                        }
                    }
                });
            });
        </script>
    </head>

Add root element to BODY:

<body>
    <div id="root"></div>
</body>

About

Recursive, pure and simple render function.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors