all repos — h3 @ aa5946a61bdde9e9be6060033f69a88d95e0450a

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
 17
import h3 from "./h3.js";
import modules from "./modules.js";
import SettingsView from "./components/SettingsView.js";
import MainView from "./components/MainView.js";

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