From ace682abbdeba13ea3664e9dde38a903a4a5da5e Mon Sep 17 00:00:00 2001 From: max Date: Wed, 26 Feb 2020 10:41:26 +0100 Subject: [PATCH] Fixes2 --- src/js/plugins/preview-thumbnails.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/plugins/preview-thumbnails.js b/src/js/plugins/preview-thumbnails.js index 7e9f0dc9..4c13ab33 100644 --- a/src/js/plugins/preview-thumbnails.js +++ b/src/js/plugins/preview-thumbnails.js @@ -138,7 +138,7 @@ class PreviewThumbnails { } // Resolve promise - const resolvePromise = () => { + const sortAndResolve = () => { // Sort smallest to biggest (e.g., [120p, 480p, 1080p]) this.thumbnails.sort((x, y) => x.height - y.height); @@ -147,13 +147,13 @@ class PreviewThumbnails { resolve(); }; // Via callback() - if (typeof(src) == 'function') { + if (is.function(src)) { // Ask let that = this; src(function(thumbnails) { that.thumbnails = thumbnails; // Resolve - resolvePromise(); + sortAndResolve(); }); } // VTT urls @@ -163,7 +163,7 @@ class PreviewThumbnails { // Loop through each src URL. Download and process the VTT file, storing the resulting data in this.thumbnails const promises = urls.map(u => this.getThumbnail(u)); // Resolve - Promise.all(promises).then(resolvePromise); + Promise.all(promises).then(sortAndResolve); } }); }