haldish-wasm
v2.1.0
Published
Kotlin/Wasm HAL client — HTTP, HAL parsing, URI templates (browser)
Maintainers
Readme
haldish-wasm
WebAssembly build of the HALDiSh HAL client — HTTP, HAL parsing, and RFC 6570 URI template expansion, compiled from Kotlin/Wasm for the browser.
npm install haldish-wasmKotlin/Wasm restricts @JsExport to functions, so this package exposes module-level functions
over shared state rather than classes. After awaiting an HTTP call, read the result with
wasmLastStatus() / wasmLastBody().
import { wasmGet, wasmLastBody, wasmVarsAdd, wasmVarsSet, wasmExpandVars, wasmClose }
from 'haldish-wasm';
await wasmGet('https://api.example.com/');
const root = JSON.parse(wasmLastBody());
wasmVarsAdd('name', 'Project A');
wasmVarsAdd('name', 'Project B');
wasmVarsSet('name_op', 'in');
const url = wasmExpandVars(root._links.projects.href);
wasmClose();Notes:
- Must be served over HTTP — browsers block WebAssembly loading from
file://. - YAML HAL (
application/hal+yaml) is not parsed on this target; JSON and XML are. - For Node.js or a class-based API, use
haldish.
Apache-2.0
