Created
May 7, 2018 14:20
-
-
Save nabettu/33f4aadc7310c9b7e3c60b7f3d6d406c to your computer and use it in GitHub Desktop.
画像あるかな関数
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkImageExist(imageSrc) { | |
return new Promise((resolve, reject) => { | |
var img = new Image(); | |
img.onload = () => { | |
resolve(imageSrc); | |
}; | |
img.onerror = () => { | |
reject(new Error("404")); | |
}; | |
img.src = imageSrc; | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment