forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tsgen] Support JSPI when emitting TypeScript definitions.
- Adds a Promise<T> wrapper around the return type for async embind functions. - Disables JSPI while generating the definitions, since it's not needed. Fixes emscripten-core#23272
- Loading branch information
1 parent
2396d3e
commit b0fd5ae
Showing
5 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <emscripten/bind.h> | ||
|
||
using namespace emscripten; | ||
|
||
void sleep() {} | ||
|
||
EMSCRIPTEN_BINDINGS(Test) { | ||
function("sleep", &sleep, async()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// TypeScript bindings for emscripten-generated code. Automatically generated at compile time. | ||
declare namespace RuntimeExports { | ||
let HEAPF32: any; | ||
let HEAPF64: any; | ||
let HEAP_DATA_VIEW: any; | ||
let HEAP8: any; | ||
let HEAPU8: any; | ||
let HEAP16: any; | ||
let HEAPU16: any; | ||
let HEAP32: any; | ||
let HEAPU32: any; | ||
let HEAP64: any; | ||
let HEAPU64: any; | ||
} | ||
interface WasmModule { | ||
} | ||
|
||
interface EmbindModule { | ||
sleep(): Promise<void>; | ||
} | ||
|
||
export type MainModule = WasmModule & typeof RuntimeExports & EmbindModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters