Previous: Web server setup, Up: Web deployment [Contents][Index]
The Scheme
class is used to load a Hoot binary, start the
program, and initialize reflection.
A Scheme runtime environment.
{}
] ¶Fetch and execute the Hoot Wasm binary at the URL path and return an array of Scheme values produced by the program.
The abi parameter is for more advanced usage where multiple Hoot
binaries share a single application binary interface (ABI). This
should be set to {}
when loading the first Scheme binary. It
is better to use the load_extension
method for subsequent
binaries, though.
The user_imports parameter is for providing concrete implementations of functions declared using the Foreign function interface. It uses a two-tier nested object structure to map import names to the functions that implement them.
For example, this Scheme code:
(define-foreign make-text-node "document" "createTextNode" (ref string) -> (ref null extern))
Could be instantiated like so:
Scheme.load_main("hello.wasm", {}, { document: { createTextNode: Document.prototype.createTextNode.bind(document) } });
{}
] ¶Fetch and load an additional Hoot binary at the URL path that
shares the ABI of this
. Optionally, a set of user-defined
imported functions can be specified with the user_imports
parameter.
All of the fundamental Scheme types have an associated JavaScript
class that can reflect their values. Calling the repr
function
on an instance of a reflected Scheme object will return a Scheme-like
printing of the object.
repr(pair) // => "(1 . 2)"
A Unicode character.
End-of-file object.
The empty list.
The unspecified value.
Complex number with real part real and imaginary part imag.
An exact fraction with numerator num and denominator denom.
The HeapObject
class is the parent class of all of the
remaining Scheme types.
A Scheme heap object.
The reflector for this
, an instance of the Scheme
class.
The reflector
property can be used in conjuction with the
load_extension
method to load additional Hoot binaries that
share the same ABI.
heapObject.reflector.load_extension("/helper.wasm")
A Scheme procedure.
Procedure instances can be invoked with the call
method to
perform a Javascript to Scheme function call.
Call procedure with args and return an array of result values.
An immutable cons cell.
A mutable cons cell.
An immutable vector.
A mutable vector.
An immutable bytevector.
A mutable bytevector.
An immutable bitvector.
A mutable bitvector.
A mutable string.
A symbol.
A keyword.
A mutable variable.
A mutable box with atomic updates.
A hash table.
A weak key hash table.
A dynamic variable.
A set of fluids.
A syntax object.
An I/O port.
A user-defined structure.
Previous: Web server setup, Up: Web deployment [Contents][Index]