WebAssembly.Suspending() constructor
The WebAssembly.Suspending() constructor creates a new Suspending object instance representing a suspending function.
The **`WebAssembly.Suspending()`** constructor creates a new [`Suspending`](/docs/WebAssembly/Reference/JavaScript_interface/Suspending) object instance representing a suspending function.
## Syntax
```js-nolint
new WebAssembly.Suspending(function)
```
### Parameters
- `function`
- : A reference to an asynchronous (Promise-based) JavaScript function.
### Return value
A new `Suspending` object instance.
### Exceptions
- [`WebAssembly.SuspendError`](/docs/WebAssembly/Reference/JavaScript_interface/SuspendError)
- : The corresponding exported function was not wrapped in a [`WebAssembly.promising()`](/docs/WebAssembly/Reference/JavaScript_interface/promising_static) call.
- TypeError
- : The referenced `function` is not callable.
## Examples
### Basic usage
```js
function someAsyncFunction() {
return fetch("https://example.com").then((result) => {
// ...
});
}
const importObj = {
someAsyncFunction: new WebAssembly.Suspending(someAsyncFunction),
};
```
See [`WebAssembly.Suspending`](/docs/WebAssembly/Reference/JavaScript_interface/Suspending) for a full working example and explanation.
## Specifications
## Browser compatibility
## See also
- [`WebAssembly.Suspending`](/docs/WebAssembly/Reference/JavaScript_interface/Suspending)
- [`WebAssembly.promising()`](/docs/WebAssembly/Reference/JavaScript_interface/promising_static)
- [WebAssembly](/docs/WebAssembly) overview
Cite this
"WebAssembly.Suspending() constructor". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/JavaScript_interface/Suspending/Suspending JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy