jsoo-mithril
jsoo-mithril
is a library that provides OCaml-style bindings for the minimal javascript framework MithrilJS. Your code should feel like OCaml rather than Javascript with certain type properies guranteed. The simplest example:
open Mithril
open Brr
let () =
let body = Document.body G.document in
let hello_world = M.(v "h1" ~children:(`String "Hello World!")) in
M.render body [ hello_world ]
Mithril Core Functionality
The M
module contains the high-level API functionality of the framework. This includes the useful functions like Mithril.M.mount
and Mithril.M.route
for building your applications.
Components For Modularity
Components are the mechanisms to encapsulate views -- ultimately they are Javascript objects with a Component
.view function
Attributes
Attributes are passed to Mithril.M.v
for constructing a Mithril.Vnode.t
Routing
The Route
module provides functions and helpers for creating routes to be passed to the M
.route function to build multi-page apps in your single-page Mithril app.
Virtual DOM Nodes
Virtual DOM Nodes or Vnodes make up the virtual DOM, the underlying data-structure that recalculates what needs rebuilding.