# WebAssembly JSPI is going to origin trial

DevFeed: [WebAssembly JSPI is going to origin trial](<https://devfeed.tech/articles/webassembly-jspi-is-going-to-origin-trial-3528.md>)

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

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

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

Content type: tutorial

Language: en

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

Topics: [WebAssembly](<https://devfeed.tech/topics/web-assembly.md>), [API](<https://devfeed.tech/topics/api.md>), [Chrome](<https://devfeed.tech/topics/chrome.md>), [Web APIs](<https://devfeed.tech/topics/web-apis.md>), [Promise](<https://devfeed.tech/topics/promise.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [chrome](<https://devfeed.tech/tags/chrome.md>), [garbage-collection](<https://devfeed.tech/tags/garbage-collection.md>), [pre-release](<https://devfeed.tech/tags/pre-release.md>), [web-apis](<https://devfeed.tech/tags/web-apis.md>), [webassembly](<https://devfeed.tech/tags/webassembly.md>)

## AI overview

WebAssembly's JavaScript Promise Integration (JSPI) API is entering a Chrome M123 origin trial. It lets sequential code compiled to WebAssembly access asynchronous Web APIs by suspending a WebAssembly application when a Promise is returned and resuming it when the Promise resolves. The article explains the Emscripten requirement, origin-trial registration options, standardization status, and performance caveats related to spawned computations and garbage collection.

## Source excerpt

WebAssembly's JavaScript Promise Integration (JSPI) API is entering an origin trial, with Chrome release M123. What that means is that you can test whether you and your users can benefit from this new API. JSPI is an API that allows so-called sequential code - that has been compiled to WebAssembly - to access Web APIs that are asynchronous. Many Web APIs are crafted in terms of JavaScript Promises: instead of immediately performing the requested operation they return a Promise to do so. When the action is finally performed, the browser's task runner invokes any callbacks with the Promise. JSPI hooks into this 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 here and the specification itself is here. Requirements # Apart from registering for an origin trial, you will also need to generate the appropriate WebAssembly and JavaScript. If you are using Emscripten, then this is straightforward. You should ensure that you are using at least version 3.1.47. Registering for the origin trial # JSPI is still pre-release; it is going through a standardization process and will not be fully released until we get to phase 4 of that process. To use it today, you can set a flag in the Chrome browser; or, you can apply for an origin trial token that will allow your users to access it without having to set the flag themselves. To register you can go here, make sure to follow the registration signup process. To find out more about origin trials in general, this is a good starting place. Some potential caveats # There have been some discussions in the WebAssembly community about some aspects of the JSPI API. As a result, there are some changes indicated, which will take time to fully work their way through the system. We anticipate that these changes will be soft launched: we will share the changes as they become available, however, the existing API wi