mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Allow image loads to fail without crashing render
This commit is contained in:
parent
ac53fa759d
commit
83beddd55a
@ -83,7 +83,11 @@ export default class ImageLoader {
|
|||||||
|
|
||||||
ready(): Promise<ImageStore> {
|
ready(): Promise<ImageStore> {
|
||||||
const keys = Object.keys(this.cache);
|
const keys = Object.keys(this.cache);
|
||||||
return Promise.all(keys.map(str => this.cache[str])).then(images => {
|
return Promise.all(keys.map(str => this.cache[str].catch(e => {
|
||||||
|
if (__DEV__) {
|
||||||
|
this.logger.log(`Unable to load image`, e);
|
||||||
|
}
|
||||||
|
}))).then(images => {
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
this.logger.log('Finished loading images', images);
|
this.logger.log('Finished loading images', images);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user