Skip to content

Use async functions wherever applicable #175

@raphinesse

Description

@raphinesse

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthacktoberfestGood issues to be tackled by newcomers as part of Hacktoberfest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions