all repos — h3 @ a10856afd1e8a04af2a7f9914b657984a56787a5

A tiny, extremely minimalist JavaScript microframework.

docs/example/assets/js/components/SettingsView.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
import { h3, h } from "../h3.js";

export default function () {
    const toggleLogging = (e) => {
        const value = e.target.checked;
        h3.dispatch("settings/set", { logging: value });
        h3.dispatch("app/save");
    };
    return h("div.settings.container", [
        h("h1", "Settings"),
        h("div.options", [
            h("input", {
                type: "checkbox",
                onclick: toggleLogging,
                checked: h3.state.settings.logging,
            }),
            h(
                "label#options-logging-label",
                {
                    for: "logging",
                },
                "Logging"
            ),
        ]),
        h(
            "a.nav-link",
            {
                onclick: () => h3.navigateTo("/"),
            },
            "← Go Back"
        ),
    ]);
}