---
title: "Introducing the WebAssembly JavaScript Promise Integration API"
description: "JSPI lets WebAssembly code written against synchronous APIs call asynchronous Web APIs."
url: "https://swe.quest/articles/introducing-the-webassembly-javascript-promise-integration-api-b17a598677f4452f"
canonical: "https://v8.dev/blog/jspi"
source: "V8"
published: "2024-07-01"
difficulty: "medium"
kind: "How-to"
reading_minutes: 11
tags: ["webassembly","javascript","c-cpp","browsers","concurrency"]
---

# Introducing the WebAssembly JavaScript Promise Integration API

A post on [V8](https://swe.quest/sources/v8.md), published 2024-07-01, 11 min read, How-to. Original: [https://v8.dev/blog/jspi](https://v8.dev/blog/jspi)

## Summary

JSPI lets WebAssembly code written against synchronous APIs call asynchronous Web APIs. It intercepts Promises returned from wrapped JavaScript imports, suspends the Wasm computation, and resumes it from the browser's event loop when the Promise resolves. Wrapped exports return a Promise instead of a direct value. JSPI changes neither JavaScript nor Wasm, and suspend/resume costs are roughly constant: a deliberately bad Promise-based Fibonacci benchmark puts each JSPI'd call at about 1μs. The API is at phase 4 and ships in Chrome 137 and Firefox 139. Emscripten examples show \`-s JSPI\` with \`EM\_ASYNC\_JS\`, plus a trampoline pattern that lazily fetches and instantiates a Wasm module on first call.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [WebAssembly](https://swe.quest/tags/webassembly.md) (Languages)
- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [C & C++](https://swe.quest/tags/c-cpp.md) (Languages)
- [Browsers](https://swe.quest/tags/browsers.md) (Web & mobile)
- [Concurrency](https://swe.quest/tags/concurrency.md) (Compilers & runtimes)

## Prerequisites

- WebAssembly basics ([easy posts on WebAssembly](https://swe.quest/tags/webassembly.md?difficulty=easy))
- JavaScript Promises ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))
- C compilation with Emscripten

## Keywords

JSPI, WebAssembly, Emscripten, V8, EM\_ASYNC\_JS, Chrome

## Related posts

- [WebAssembly JSPI has a new API](https://swe.quest/articles/webassembly-jspi-has-a-new-api-8f87900c3d9ad3d8.md): V8 · 2024-06-04 · Medium · 6 min read · WebAssembly, Browsers, Concurrency, Runtimes & VMs
  WebAssembly JavaScript Promise Integration (JSPI) ships a revised API in Chrome M126 that drops explicit Suspender objects and instead uses the most recent JS-to-Wasm export call as the suspension cut point.
- [Why is WebAssembly a second-class language on the web?](https://swe.quest/articles/why-is-webassembly-a-second-class-language-on-the-web-36ba94a05082ce89.md): Mozilla Hacks · 2026-02-26 · Medium · 13 min read · WebAssembly, Browsers, Language design, Performance engineering
  WebAssembly remains second-class on the web because it can only load code and reach Web APIs through JavaScript.
- [Bringing Javascript to WebAssembly for Shopify Functions](https://swe.quest/articles/bringing-javascript-to-webassembly-for-shopify-functions-80a81868faf1489b.md): Shopify Engineering · 2023-02-09 · Medium · 16 min read · WebAssembly, JavaScript, Runtimes & VMs, Rust, Serverless
  Shopify runs JavaScript in Shopify Functions by compiling the QuickJS interpreter to WebAssembly/WASI via Javy.
- [Introducing Turso in the Browser](https://swe.quest/articles/introducing-turso-in-the-browser-111a711a5e4d489d.md): Turso · 2025-10-08 · Medium · 3 min read · SQLite, WebAssembly, Browsers, Local-first & sync, JavaScript
  Turso, a from-scratch SQLite rewrite, now runs in the browser via WebAssembly as the npm package @tursodatabase/database-wasm, with a better-sqlite3-like API whose methods are all async because of OPFS.
- [Introducing the JetStream 3 Benchmark Suite](https://swe.quest/articles/introducing-the-jetstream-3-benchmark-suite-df1c85fb12e2a75d.md): WebKit · 2026-03-31 · Hard · 21 min read · Runtimes & VMs, WebAssembly, Compilers, Memory management, Performance engineering
  JetStream 3 replaces JetStream 2's separate Wasm Startup/Runtime scores with the JavaScript-style first-iteration, worst-case and average-case scoring.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
