Created
October 6, 2017 14:37
-
-
Save alenabdula/c37ab63f93d97115e232e69fb8702414 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
preloadPhotographs() { | |
let photos = this.photographs; | |
let preloaded = new Array(); | |
photos.forEach(photo => { | |
let image = new Image(); | |
image.src = photo.source; | |
image.onload = () => { | |
preloaded.push(image); | |
if (preloaded.length === photos.length) { | |
this.loading = false; | |
// Event.$emit('loading', false); | |
} | |
}; | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment