BridgeJS: support imports of JS Promise as async Swift#707
Open
MaxDesiatov wants to merge 10 commits intomainfrom
Open
BridgeJS: support imports of JS Promise as async Swift#707MaxDesiatov wants to merge 10 commits intomainfrom
Promise as async Swift#707MaxDesiatov wants to merge 10 commits intomainfrom
Conversation
Promise JS as async SwiftPromise as async Swift
Member
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 { |
Member
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 ?
| #expect(try weather2.temperature == 25.0) | ||
| #expect(try weather2.description == "Sunny") | ||
| #expect(try weather2.humidity == 40) | ||
| } |
Member
There was a problem hiding this comment.
Can you cover more cases especially around types using Stack ABI
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.