all repos — h3 @ a10856afd1e8a04af2a7f9914b657984a56787a5

A tiny, extremely minimalist JavaScript microframework.

docs/example/assets/js/app.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
import { h3, h } from "./h3.js";
import modules from "./modules.js";
import SettingsView from "./components/SettingsView.js";
import MainView from "./components/MainView.js";

h3.init({
    modules,
    preStart: () => {
        h3.dispatch("app/load");
        h3.dispatch("settings/set", h3.state.settings);
    },
    routes: {
        "/settings": SettingsView,
        "/": MainView,
    },
});