# WebAssembly JSPI has a new API

DevFeed: [WebAssembly JSPI has a new API](<https://devfeed.tech/articles/webassembly-jspi-has-a-new-api-3527.md>)

Original publisher: [Read original article](<https://v8.dev/blog/jspi-newapi>)

Author: Francis McCabe, Thibaud Michaud, Ilya Rezvov, Brendan Dahl

Published: 2024-06-04T00:00:00Z

Content type: release

Language: en

Sources: [V8](<https://devfeed.tech/sources/v8.md>)

Topics: [Web platform](<https://devfeed.tech/topics/web-platform.md>), [web-standards](<https://devfeed.tech/topics/web-standards.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [integration](<https://devfeed.tech/tags/integration.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [release](<https://devfeed.tech/tags/release.md>), [web-apis](<https://devfeed.tech/tags/web-apis.md>), [webassembly](<https://devfeed.tech/tags/webassembly.md>)

## AI overview

WebAssembly JSPI has a new API in Chrome M126. The update removes explicit Suspender objects, replaces WebAssembly.Function-based wrappers with dedicated functions and constructors, and suspends calls only when a JavaScript function returns a Promise.

## Source excerpt

WebAssembly's JavaScript Promise Integration (JSPI) API has a new API, available in Chrome release M126. We talk about what has changed, how to use it with Emscripten, and what is the roadmap for JSPI. JSPI is an API that allows WebAssembly applications that use sequential APIs to access Web APIs that are asynchronous. Many Web APIs are crafted in terms of JavaScript Promise objects: instead of immediately performing the requested operation, they return a Promise to do so. On the other hand, many applications compiled to WebAssembly come from the C/C++ universe, which is dominated by APIs that block the caller until they are completed. JSPI hooks into the Web architecture to allow a WebAssembly application to be suspended when the Promise is returned and resumed when the Promise is resolved. You can find out more about JSPI and how to use it in this blog post and in the specification. What is new? # The end of Suspender objects # In January 2024, the Stacks sub-group of the Wasm CG voted to amend the API for JSPI. Specifically, instead of an explicit Suspender object, we will use the JavaScript/WebAssembly boundary as the delimiter for determining what computations are suspended. The difference is fairly small but potentially significant: when a computation is to be suspended, it is the most recent call into a wrapped WebAssembly export that determines the 'cut point' for what is suspended. The implication of this is that a developer using JSPI has a little less control over that cut point. On the other hand, not having to explicitly manage Suspender objects makes the API significantly easier to use. No more WebAssembly.Function # Another change is to the style of the API. Instead of characterizing JSPI wrappers in terms of the WebAssembly.Function constructor, we provide specific functions and constructors. This has a number of benefits: It removes dependency on the Type Reflection Proposal. It makes tooling for JSPI simpler: the new API functions no longer need to