Skip to content
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

Use async functions wherever applicable #175

Open
11 tasks
raphinesse opened this issue Nov 21, 2019 · 0 comments
Open
11 tasks

Use async functions wherever applicable #175

raphinesse opened this issue Nov 21, 2019 · 0 comments
Labels
enhancement New feature or request hacktoberfest Good issues to be tackled by newcomers as part of Hacktoberfest

Comments

@raphinesse
Copy link
Contributor

raphinesse commented Nov 21, 2019

Using the async keyword ensures that a function will always return a Promise. Previously this was achieved by wrapping the function body in return Promise.resolve().then(…) which has a very slight async penalty and can make stack traces harder to read.

Definition of done

For all known asynchronous functions:

  • add async keyword
  • undo wrapping in Promise.resolve().then(…) if applicable
  • undo any explicit result wrapping
    return Promise.resolve(…)return …
  • throw errors instead of returning rejections
    return Promise.reject(new Error(…))throw new Error(…)
  • optional: use await & try/catch in the function body instead of traditional promise handling

Task list

Tools/libs

Platforms (only the Node.js part)

  • cordova-android
  • cordova-browser
  • cordova-ios
  • cordova-windows
@raphinesse raphinesse added enhancement New feature or request hacktoberfest Good issues to be tackled by newcomers as part of Hacktoberfest labels Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest Good issues to be tackled by newcomers as part of Hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant