Service Workers to cache image
This commit is contained in:
parent
c40e5fa441
commit
c2ec359f7b
6 changed files with 52 additions and 0 deletions
|
@ -1885,6 +1885,13 @@ document.addEventListener('musickitloaded', function () {
|
|||
request.send();
|
||||
});
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
// Use the window load event to keep the page load performant
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('sw.js?v=1');
|
||||
});
|
||||
}
|
||||
|
||||
function uuidv4() {
|
||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
|
||||
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue