From 3b751a698f27a106088ef496e8a1c89b94f7e7af Mon Sep 17 00:00:00 2001 From: natalan Date: Fri, 7 Jun 2019 13:50:51 -0400 Subject: [PATCH] refactor for..of to reduce array instead --- src/js/print.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/js/print.js b/src/js/print.js index 3a76dbd..bbcd644 100644 --- a/src/js/print.js +++ b/src/js/print.js @@ -68,11 +68,12 @@ function performPrint (iframeElement, params) { } function loadIframeImages (images) { - const promises = [] - - for (let image of images) { - if (image.src && image.src !== window.location.href) promises.push(loadIframeImage(image)) - } + const promises = Array.prototype.slice.call(images).reduce((memo, image) => { + if (image.src && image.src !== window.location.href) { + memo.push(loadIframeImage(image)); + } + return memo; + }, []); return Promise.all(promises) }