Commit 624fb90c authored by Christian Sadilek's avatar Christian Sadilek
Browse files

Issue #2985: Add fallback in case Promise.any not available

parent f7d306a0
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -337,7 +337,16 @@ function connectNativePort() {
      case 'show':
        async function showAsync(options) {
          try {
            let doc = await Promise.any([fetchDocument(articleUrl), getPreparedDocument(id, articleUrl)]);
            let doc;
            if (typeof Promise.any === "function") {
              doc = await Promise.any([fetchDocument(articleUrl), getPreparedDocument(id, articleUrl)]);
            } else {
              try {
                doc = await getPreparedDocument(id, articleUrl);
              } catch(e) {
                doc = await fetchDocument(articleUrl);
              }
            }
            readerView.show(doc, articleUrl, options);
          } catch(e) {
            console.log(e);