BridgeJS: support imports of JS Promise as async Swift#707
BridgeJS: support imports of JS Promise as async Swift#707MaxDesiatov wants to merge 21 commits intomainfrom
Promise as async Swift#707Conversation
Promise JS as async SwiftPromise as async Swift
kateinoigakukun
left a comment
There was a problem hiding this comment.
I think we need a different approach using JSTypedClosure to avoid the boxing
| import Testing | ||
| import JavaScriptKit | ||
|
|
||
| @Suite struct AsyncImportTests { |
There was a problem hiding this comment.
Can you follow the pattern we have in recent other suites like https://github.com/swiftwasm/JavaScriptKit/blob/main/Tests/BridgeJSRuntimeTests/ArraySupportTests.swift ?
There was a problem hiding this comment.
Can you elaborate? Which specific pattern are you referring to? I suppose that's not the use of XCTest?
There was a problem hiding this comment.
I mean, I'd like to avoid adding more and more imports in prelude.mjs and want to split into separate file like this: https://github.com/swiftwasm/JavaScriptKit/blob/main/Tests/BridgeJSRuntimeTests/JavaScript/ArraySupportTests.mjs
There was a problem hiding this comment.
Thanks, also addressed
c8de4e0 to
14561d4
Compare
Supersedes #486.
Provides a motivating example with
fetchWeatherData()test. The full end-to-end flow works:interface WeatherData { temperature: number; description: string; humidity: number; };fetchWeatherData(city: string): Promise<WeatherData>;Promise.resolve({ temperature: 15.5, description: "Cloudy", humidity: 80 });WeatherDatastruct with.temperature,.description,.humidityproperties;JSValueunwrapping for this and analogous functions backed byfetch(...).json().Compatible with Embedded Swift.
Additionally,
@JSFunctionnow supportsasynceffects.