apache / cordova-fetch

Apache Cordova Fetch Library
https://cordova.apache.org/
Apache License 2.0
27 stars 27 forks source link

refactor: use async/await where applicable #89

Closed raphinesse closed 4 years ago

raphinesse commented 4 years ago

Motivation and Context

Preparation of a potential fix for https://github.com/apache/cordova-lib/issues/859

Also: https://github.com/apache/cordova/issues/175

Description

Use async/await where applicable

Testing

All automated tests still pass

codecov-io commented 4 years ago

Codecov Report

Merging #89 into master will increase coverage by 0.11%. The diff coverage is 89.74%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #89      +/-   ##
==========================================
+ Coverage   92.30%   92.42%   +0.11%     
==========================================
  Files           1        1              
  Lines          65       66       +1     
==========================================
+ Hits           60       61       +1     
  Misses          5        5              
Impacted Files Coverage Δ
index.js 92.42% <89.74%> (+0.11%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8dc1fe1...6511ecc. Read the comment docs.

raphinesse commented 4 years ago

One of these days I suppose I'll get used to this newfangled syntax, but I still think promises are more readable and make the async steps more explicit

Promises are definitely more explicit and allow for very pretty code sometimes. And I also agree with async/await taking some getting used to. But once you are used to it, I think it really excels at making control flow involving async functions easier and more readable.

Anyway, thanks for the reviews :bow: