Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Owebview
A thin OCaml binding to webview: open a native window backed by the operating system's web engine, load HTML/CSS/JS, and bridge JavaScript with OCaml — no Electron, no bundler.
Quickstart
A whole application is about ten lines:
let () =
let w = Webview.create () in
Webview.set_title w "My first owebview app";
Webview.set_size w ~width:480 ~height:320 Webview.Hint_none;
Webview.set_html w "<h1>Hello from OCaml</h1>";
Webview.run w;
Webview.destroy w
Call OCaml from the page and answer the JavaScript promise:
Webview.bind w "add" (fun id req ->
let result =
match Scanf.sscanf_opt req "[%d,%d]" (fun a b -> a + b) with
| Some n -> string_of_int n
| None -> "null"
in
Webview.return w id ~error:false ~result)
API
The whole binding is the Webview module. A tour of it: