Skip to content

Commit

Permalink
link preload added for covers
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammed committed Aug 13, 2019
1 parent bbce16b commit 9dc4735
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,15 @@ new Vue({
vm.nextTrack();
this.isTimerPlaying = true;
};

// this is optional (for preload covers)
for (let index = 0; index < this.tracks.length; index++) {
const element = this.tracks[index];
let link = document.createElement('link');
link.rel = "prefetch";
link.href = element.cover;
link.as = "image"
document.head.appendChild(link)
}
}
});

0 comments on commit 9dc4735

Please sign in to comment.