Skip to content

Instantly share code, notes, and snippets.

@alenabdula
Created October 6, 2017 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alenabdula/c37ab63f93d97115e232e69fb8702414 to your computer and use it in GitHub Desktop.
Save alenabdula/c37ab63f93d97115e232e69fb8702414 to your computer and use it in GitHub Desktop.
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