Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BridgeJS: Async function support#404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kateinoigakukun merged 1 commit intomainfromyt/bridgejs-async
Aug 17, 2025
Merged

Conversation

@kateinoigakukun
Copy link
Member

@kateinoigakukunkateinoigakukun commentedAug 13, 2025
edited
Loading

This PR adds comprehensive async function support to BridgeJS, enabling seamless interoperability between Swift async functions and JavaScript Promises.
Swift functions marked withasync are now automatically exposed as JavaScript functions returningPromise<T>

Implementation Details

Core Changes

  • ExportSwift.swift: Modified to detect async functions and wrap calls withJSPromise.async, handling proper return value conversion
  • BridgeJSLink.swift: Updated TypeScript signature generation to emitPromise<T> for async functions
  • TypeScript processor: Enhanced to recognize Promise types and generate appropriate bridge types

API Changes

  • Import initialization: Changed fromimports: {...} togetImports() { return {...} } pattern to allow accessingexports inside imports implementation.

Example Usage

Swift side:

@JSfunc fetchUserData(_ userId:String)async->String{    // Async Swift implementationreturn userData}

Generated JavaScript/TypeScript:

exporttypeExports={fetchUserData(userId:string):Promise<string>;}

This enhancement significantly improves the developer experience when working with async Swift code in JavaScript environments, providing type-safe Promise-based APIs that feel natural in both languages.

@kateinoigakukunkateinoigakukun linked an issueAug 13, 2025 that may beclosed by this pull request
@kateinoigakukunkateinoigakukunforce-pushed theyt/bridgejs-async branch 3 times, most recently frombf5f4d9 to139ea1cCompareAugust 17, 2025 02:52
Implements comprehensive async Swift-to-JavaScript interoperability using JSPromise.async wrapper.Includes TypeScript Promise<T> type generation and full integration with module name architecture.
@kateinoigakukunkateinoigakukun marked this pull request as ready for reviewAugust 17, 2025 04:35
@kateinoigakukunkateinoigakukun merged commit3176b60 intomainAug 17, 2025
9 checks passed
@kateinoigakukunkateinoigakukun deleted the yt/bridgejs-async branchAugust 17, 2025 05:30
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

BridgeJS: Support exposingasync functions

2 participants

@kateinoigakukun

[8]ページ先頭

©2009-2025 Movatter.jp