Home >Web Front-end >JS Tutorial >Introducing our Next-Generation JavaScript SDK
By: Till Schneidereit
Today we’re happy to announce the availability of our brand-new JavaScript SDK. This SDK is a complete rewrite of our previous JavaScript SDK, with much improved ecosystem compatibility, standards compliance, robustness, and key new features.
This release also sets us on a path towards significant performance improvements and ongoing improvements to compatibility with existing JavaScript applications.
At the same time, we’re retaining a high degree of compatibility with the previous SDK, so upgrading should be straightforward for most users.
Let’s dive into more detail on what’s new and different about this release.
Where the previous SDK was built on top of the QuickJS JavaScript engine and the Javy runtime, the new SDK is built on top of the Firefox browser’s SpiderMonkey engine, and the Bytecode Alliance’s StarlingMonkey runtime and ComponentizeJS WIT bindings generator.
Together, these projects provide a fantastic foundation for our SDK:
As described above, the new implementation of our JS support could hardly be more different from the old one. The good news is that, thanks to the fact that JavaScript has an exceptionally robust specification, we can do all this without risking subtle breakage of existing code. While the new SDK comes with a slightly tweaked API that requires equally slight changes when upgrading existing projects, entirely replacing the underlying platform otherwise does not have any compatibility impact.
From there, they can then start taking advantage of the new features that the new SDK brings. Notably, we tweaked the API to make it easy to integrate streaming HTTP bodies without having to completely rewrite existing code.
We implemented support for (a slightly tweaked version of) the existing APIs on top of the fetch API and Service Workers spec standards. Developers can choose to directly work with these standards if they prefer, giving them substantially improved compatibility with the broader web and JS ecosystem.
Standards help in a completely different way, too: since all of the HTTP support is now built using wasi-http, applications built with the new SDK that don’t make use of the Spin-specific APIs we also support can run in any environment that supports wasi-http, such as Wasmtime and Node.js (via JCO).
With this release, we focused on changing the underlying platform for our JavaScript support in a drop-in compatible way, while already gaining support for modern web standards, composability with other WebAssembly components, and a more robust and mature foundation for future development.
Going forward, we’ll see rapid improvements in performance, compatibility, and new features. As a sneak peek, some of the most exciting developments in the works are:
The above is the detailed content of Introducing our Next-Generation JavaScript SDK. For more information, please follow other related articles on the PHP Chinese website!