The WebAssembly.Suspending() constructor creates a new Suspending object instance representing a suspending function.
new WebAssembly.Suspending(function)functionA reference to an asynchronous (Promise-based) JavaScript function.
A new Suspending object instance.
WebAssembly.SuspendErrorThe corresponding exported function was not wrapped in a WebAssembly.promising() call.
TypeErrorThe referenced function is not callable.
function someAsyncFunction() {
return fetch("https://example.com").then((result) => {
// ...
});
}
const importObj = {
someAsyncFunction: new WebAssembly.Suspending(someAsyncFunction),
};See WebAssembly.Suspending for a full working example and explanation.