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.
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Asyncify support #107
base: main
Are you sure you want to change the base?
Add Asyncify support #107
Changes from 4 commits
d3b0a4c
62953b7
074467d
3ae49b6
ccb7297
a3dcfa7
8704225
d1fff95
2def067
a733efb
bcfa3cb
cd302ce
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we expose only
swjs_sync_await
to minimize runtime functions? I think others can be implemented on Swift side.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await_with_timeout definitely can be removed and easily implemented by callers. Not sure about the sleep one, as
setTimout
doesn't return a proper Promise implementing that from Swift side would be kind of ugly, and sleep is the most useful for imported c code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the withTimeout function. @kateinoigakukun What do you think would be best regarding sleep?
delay
promise on first request with JSPromise-JSTimer code, cache it atJSObject.global
for future use, then call it. Cons: Swift code will be ugly and less efficient, polluting global namespace.sleep
is a special case ofwait
, it is arguably more useful and a surprise to users when they can't find it. And while adding the global JS function is trivial if you know about it, connecting these dots cold be difficult to newcomers. Plus, I hope actual C code can use it directly.Or any other ideas?