@@ -9,7 +9,7 @@ public func pauseExecution(milliseconds: Int32) {
9
9
}
10
10
11
11
12
- extension JSPromise where Success == JSValue , Failure == JSError {
12
+ extension JSPromise {
13
13
/// Unwind Wasm module execution stack and rewind it after promise resolves,
14
14
/// allowing JavaScript events to continue to be processed in the meantime.
15
15
/// - Parameters:
@@ -18,19 +18,15 @@ extension JSPromise where Success == JSValue, Failure == JSError {
18
18
///
19
19
/// **Important**: Wasm module must be [asyncified](https://emscripten.org/docs/porting/asyncify.html),
20
20
/// otherwise JavaScriptKit's runtime will throw an exception.
21
- public func syncAwait( ) -> Result < Success , Failure > {
21
+ public func syncAwait( ) -> Result < JSValue , JSValue > {
22
22
var kindAndFlags = JavaScriptValueKindAndFlags ( )
23
23
var payload1 = JavaScriptPayload1 ( )
24
24
var payload2 = JavaScriptPayload2 ( )
25
25
26
26
_syncAwait ( jsObject. id, & kindAndFlags, & payload1, & payload2)
27
27
let result = RawJSValue ( kind: kindAndFlags. kind, payload1: payload1, payload2: payload2) . jsValue ( )
28
28
if kindAndFlags. isException {
29
- if let error = JSError ( from: result) {
30
- return . failure( error)
31
- } else {
32
- return . failure( JSError ( message: " Could not build proper JSError from result \( result) " ) )
33
- }
29
+ return . failure( result)
34
30
} else {
35
31
return . success( result)
36
32
}
0 commit comments