File tree 4 files changed +11
-4
lines changed
Plugins/PackageToJS/Templates
4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change
1
+ type ref = number ;
2
+ type pointer = number ;
3
+
1
4
declare class Memory {
2
5
readonly rawMemory : WebAssembly . Memory ;
3
6
private readonly heap ;
@@ -18,9 +21,6 @@ declare class Memory {
18
21
writeFloat64 : ( ptr : pointer , value : number ) => void ;
19
22
}
20
23
21
- type ref = number ;
22
- type pointer = number ;
23
-
24
24
/**
25
25
* A thread channel is a set of functions that are used to communicate between
26
26
* the main thread and the worker thread. The main thread and the worker thread
@@ -189,6 +189,7 @@ declare class SwiftRuntime {
189
189
private textEncoder ;
190
190
/** The thread ID of the current thread. */
191
191
private tid ;
192
+ UnsafeEventLoopYield : typeof UnsafeEventLoopYield ;
192
193
constructor ( options ?: SwiftRuntimeOptions ) ;
193
194
setInstance ( instance : WebAssembly . Instance ) : void ;
194
195
main ( ) : void ;
@@ -209,6 +210,8 @@ declare class SwiftRuntime {
209
210
private postMessageToMainThread ;
210
211
private postMessageToWorkerThread ;
211
212
}
213
+ declare class UnsafeEventLoopYield extends Error {
214
+ }
212
215
213
216
export { SwiftRuntime } ;
214
217
export type { SwiftRuntimeOptions , SwiftRuntimeThreadChannel } ;
Original file line number Diff line number Diff line change 312
312
this . version = 708 ;
313
313
this . textDecoder = new TextDecoder ( "utf-8" ) ;
314
314
this . textEncoder = new TextEncoder ( ) ; // Only support utf-8
315
+ this . UnsafeEventLoopYield = UnsafeEventLoopYield ;
315
316
/** @deprecated Use `wasmImports` instead */
316
317
this . importObjects = ( ) => this . wasmImports ;
317
318
this . _instance = null ;
Original file line number Diff line number Diff line change @@ -306,6 +306,7 @@ class SwiftRuntime {
306
306
this . version = 708 ;
307
307
this . textDecoder = new TextDecoder ( "utf-8" ) ;
308
308
this . textEncoder = new TextEncoder ( ) ; // Only support utf-8
309
+ this . UnsafeEventLoopYield = UnsafeEventLoopYield ;
309
310
/** @deprecated Use `wasmImports` instead */
310
311
this . importObjects = ( ) => this . wasmImports ;
311
312
this . _instance = null ;
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ export class SwiftRuntime {
38
38
/** The thread ID of the current thread. */
39
39
private tid : number | null ;
40
40
41
+ UnsafeEventLoopYield = UnsafeEventLoopYield ;
42
+
41
43
constructor ( options ?: SwiftRuntimeOptions ) {
42
44
this . _instance = null ;
43
45
this . _memory = null ;
@@ -749,4 +751,4 @@ export class SwiftRuntime {
749
751
/// This error is thrown to unwind the call stack of the Swift program and return the control to
750
752
/// the JavaScript side. Otherwise, the `swift_task_asyncMainDrainQueue` ends up with `abort()`
751
753
/// because the event loop expects `exit()` call before the end of the event loop.
752
- export class UnsafeEventLoopYield extends Error { }
754
+ class UnsafeEventLoopYield extends Error { }
You can’t perform that action at this time.
0 commit comments