xWrap

abstract fun xWrap(functionName: JsString, resultType: JsString, vararg argsTypes: JsString)(source)
abstract fun xWrap(functionName: JsString, resultType: JsString, argsTypes: ReadonlyArray<JsString>)(source)

xWrap() creates a JS function which calls a WASM-exported function, as described for xCall().

Creates a wrapper for the WASM-exported function fname. It uses xGet() to fetch the exported function (which throws on error) and returns either that function or a wrapper for that function which converts the JS-side argument types into WASM-side types and converts the result type. If the function takes no arguments and resultType is null then the function is returned as-is, else a wrapper is created for it to adapt its arguments and result value.