Currently in an experimental stage, JSPI should not be used in production applications yet, the developers said. Eventually, it will become a standard, for implementation across major browsers, they said.
Introduced in a V8 blog post on January 19, 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 concluded. And JSPI does this with very few changes to the application itself.
Working with Promises is difficult, particularly with WebAssembly, because direct manipulation of Promises in WebAssembly is not possible, the developers said. JSPI allows developers to craft WebAssembly applications using synchronous APIs and still participate in the web’s asynchronous ecosystem.
WebAssembly has been hailed as a breakthrough in web application performance. The binary instruction format enables many different programming languages including C/C++, C#, and Rust to be used for web programming.
Copyright © 2023 IDG Communications, Inc.
Source : https://www.infoworld.com/article/3686098/google-v8-api-bridges-webassembly-and-asynchronous-web.html#tk.rss_all