diff options
author | Andrew Dolgov <[email protected]> | 2023-11-02 23:41:29 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-11-02 23:41:29 +0300 |
commit | 879ee8b1ae6aef4a59821317236c4e3740f96f14 (patch) | |
tree | b2335de8ca87a295292fd914c9f22bcd38b467c6 /js | |
parent | 5864befe817ab139923282314e10c2207f7013b2 (diff) |
add Promise.allSettled polyfill
Diffstat (limited to 'js')
-rw-r--r-- | js/reader.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/js/reader.js b/js/reader.js index 0cb1410..047ad1a 100644 --- a/js/reader.js +++ b/js/reader.js @@ -10,6 +10,19 @@ const MIN_LENGTH_TO_JUSTIFY = 32; /* characters */ const LOCATION_DIVISOR = 10; const PAGE_RESET_PROGRESS = -1; +Promise.allSettled = Promise.allSettled || ((promises) => Promise.all( + promises.map((p) => p + .then((value) => ({ + status: "fulfilled", + value + })) + .catch((reason) => ({ + status: "rejected", + reason + })) + ) +)); + const Reader = { csrf_token: "", last_stored_cfi: "", |