Skip to main content

Module session

Module session 

Source
Expand description

A program the VM has run, held open so a host can call back into it.

A browser instantiates a page’s module, runs main once, and from then on calls INTO it — an event handler, a fetch completion, a timer tick, a failure handler. Each is the host invoking an export by name or a closure the module handed it earlier, against the globals main built. A trap unwinds to the host and leaves the instance callable.

Session is that shape for the in-process bytecode VM: Session::run_main once, then Session::invoke and Session::call_value for as long as the host likes. It is the seam page_host drives a lowered page through, and what lets a host-delivered completion run in-process at all.

Structs§

Session
A VM whose program has run (or is about to), open to calls from the host.