jsFuncToWasm

abstract fun jsFuncToWasm(signature: JsString, function: JsFunction): WasmFunction(source)

Creates a WASM function which wraps the given JS function and returns the JS binding of that WASM function. The function signature string must be in the form used by jaccwabyt or Emscripten's addFunction(). In short: in may have one of the following formats:

  • Emscripten: "x...", where the first x is a letter representing the result type and subsequent letters represent the argument types. See below. Functions with no arguments have only a single letter.

  • Jaccwabyt: "x(...)" where x is the letter representing the result type and letters in the parens (if any) represent the argument types. Functions with no arguments use x(). See below.

Supported letters:

  • i = int32

  • p = int32 ("pointer")

  • j = int64

  • f = float32

  • d = float64

  • v = void, only legal for use as the result type

It throws if an invalid signature letter is used.