Skip to content

feat(examples): Add comprehensive JsPromise example - #4198

Merged
jedel1043 merged 3 commits into
boa-dev:mainfrom
created-by-varun:created-by-varun-jspromise-example
Mar 13, 2025
Merged

feat(examples): Add comprehensive JsPromise example#4198
jedel1043 merged 3 commits into
boa-dev:mainfrom
created-by-varun:created-by-varun-jspromise-example

Conversation

@created-by-varun

Copy link
Copy Markdown
Contributor

This Pull Request fixes/closes #2761

It changes the following:

This commit adds a new example demonstrating various features of JsPromise:

  • Basic promise creation and handling
  • Promise chaining with then/catch/finally
  • Promise.all example with multiple promises
  • Promise.race example with timing
  • Promise.any example with mixed resolve/reject

The example uses tokio for async functionality and demonstrates proper error handling and promise state management.

This commit adds a new example demonstrating various features of JsPromise:
- Basic promise creation and handling
- Promise chaining with then/catch/finally
- Promise.all example with multiple promises
- Promise.race example with timing
- Converting Rust Future to Promise using from_future
- Promise.any example with mixed resolve/reject

The example uses tokio for async functionality and demonstrates proper
error handling and promise state management.
@codecov

codecov Bot commented Mar 5, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.68%. Comparing base (6ddc2b4) to head (fc89536).
Report is 392 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4198      +/-   ##
==========================================
+ Coverage   47.24%   52.68%   +5.44%     
==========================================
  Files         476      488      +12     
  Lines       46892    52005    +5113     
==========================================
+ Hits        22154    27401    +5247     
+ Misses      24738    24604     -134     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@created-by-varun

Copy link
Copy Markdown
Contributor Author

Hi @jedel1043
Here is my PR for #2761
I've resolved the linter errors as well and updated the PR.

Let me know if there's anything I need to add/change in the examples.
Thanks!

@nekevss
nekevss requested a review from a team March 7, 2025 03:06
@nekevss nekevss added C-Documentation update documentation C-Builtins PRs and Issues related to builtins/intrinsics labels Mar 7, 2025
@created-by-varun

Copy link
Copy Markdown
Contributor Author

Hi team
@jedel1043 @nekevss
Just a reminder for the above PR - don't want it to go stale like the previous one for the same issue
Thanks

@jedel1043 jedel1043 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the reminder! I think this looks good, and it extensively uses all the Promise APIs exposed, so thank you for the contribution!

@jedel1043
jedel1043 added this pull request to the merge queue Mar 13, 2025
Merged via the queue into boa-dev:main with commit 7ab7aaf Mar 13, 2025
@created-by-varun
created-by-varun deleted the created-by-varun-jspromise-example branch March 14, 2025 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Builtins PRs and Issues related to builtins/intrinsics C-Documentation update documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add usage example for JsPromise wrapper

3 participants