Skip to content
velt/host exports

velt/host

API reference

What host functions pass besides numbers, strings and bytes: JS values. A host function is one the JavaScript host provides to a program built as a WebAssembly module for it (--target wasm32-unknown-unknown: a browser, Node, Deno, Cloudflare Workers), declared with declare host("<module>") function. For a walkthrough, read the guide.

import { HostRef } from "velt/host";

Exports

Re-exported from velt/host/host_ref

A JS value the host keeps for the program: a slot of the table the JS glue keeps (crates/velt_rt_wasm/js/velt_web.mjs). Only host functions make one.

clone(): HostRef

A second reference to the same JS value (a slot of its own).

[Symbol.dispose]()

Drop hook: the host forgets the value.