Currently in the experimental stage, JSPI is not yet expected to be used in production applications, the developers said. Eventually it will become a standard, for implementation across major browsers, they said.
Introduced in a January 19 V8 blog post, JSPI bridges synchronous WebAssembly applications and asynchronous Web APIs. This is done by suspending the application when it issues a synchronous API call and resuming when the asynchronous I/O operation is complete. And JSPI does this with very few changes to the application itself.
Working with Promises is difficult, especially with WebAssembly, because direct manipulation of Promises in WebAssembly is not possible, the developers said. JSPI allows developers to build WebAssembly applications using synchronous APIs while participating in the web’s asynchronous ecosystem.
WebAssembly was hailed as a breakthrough in web application performance. The binary instruction format allows many different programming languages, including C/C++, C#, and Rust, to be used for web programming.
Copyright © 2023 IDG Communications, Inc.