Fixes
This commit is contained in:
@ -138,7 +138,7 @@ class PreviewThumbnails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve promise
|
// Resolve promise
|
||||||
const exec_resolve = () => {
|
const resolvePromise = () => {
|
||||||
// Sort smallest to biggest (e.g., [120p, 480p, 1080p])
|
// Sort smallest to biggest (e.g., [120p, 480p, 1080p])
|
||||||
this.thumbnails.sort((x, y) => x.height - y.height);
|
this.thumbnails.sort((x, y) => x.height - y.height);
|
||||||
|
|
||||||
@ -147,11 +147,14 @@ class PreviewThumbnails {
|
|||||||
resolve();
|
resolve();
|
||||||
};
|
};
|
||||||
// Via callback()
|
// Via callback()
|
||||||
if( typeof(src) == 'function' ) {
|
if (typeof(src) == 'function') {
|
||||||
// Ask
|
// Ask
|
||||||
this.thumbnails = src();
|
let that = this;
|
||||||
// Resolve
|
src(function(thumbnails) {
|
||||||
exec_resolve();
|
that.thumbnails = thumbnails;
|
||||||
|
// Resolve
|
||||||
|
resolvePromise();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// VTT urls
|
// VTT urls
|
||||||
else {
|
else {
|
||||||
@ -160,7 +163,7 @@ class PreviewThumbnails {
|
|||||||
// Loop through each src URL. Download and process the VTT file, storing the resulting data in this.thumbnails
|
// 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));
|
const promises = urls.map(u => this.getThumbnail(u));
|
||||||
// Resolve
|
// Resolve
|
||||||
Promise.all(promises).then(exec_resolve);
|
Promise.all(promises).then(resolvePromise);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user