mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 10:31:20 -08:00
Update index.js
This commit is contained in:
1 parent
34e2545d5f
commit
161d6e3e8b
1 file changed
+4
-3
@@ -1,3 +1,4 @@
|
|||||||
|
import { ArtPlayerError } from '../utils/error';
|
||||||
import clickInit from './clickInit';
|
import clickInit from './clickInit';
|
||||||
import hoverInit from './hoverInit';
|
import hoverInit from './hoverInit';
|
||||||
import mousemoveInit from './mousemoveInit';
|
import mousemoveInit from './mousemoveInit';
|
||||||
@@ -54,7 +55,7 @@ export default class Events {
|
|||||||
image = new Image();
|
image = new Image();
|
||||||
image.src = img;
|
image.src = img;
|
||||||
} else {
|
} else {
|
||||||
return reject(img);
|
return reject(new ArtPlayerError('Unable to get Image'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image.complete) {
|
if (image.complete) {
|
||||||
@@ -62,9 +63,9 @@ export default class Events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.proxy(image, 'load', () => resolve(image));
|
this.proxy(image, 'load', () => resolve(image));
|
||||||
this.proxy(image, 'error', () => reject(image));
|
this.proxy(image, 'error', () => reject(new ArtPlayerError(`Failed to load Image: ${image.src}`)));
|
||||||
|
|
||||||
return img;
|
return resolve(image);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user