-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to Cub's Contraption v1.0.1 release
> Added more `meta`s, removed Roboto as loaded font > Major changes 1. Made design more flexible 2. Changed design very much 3. Coloring of elements now moves around a new variable --theme-color 4. Improved color accessibility 5. Changed finishEditing() > Added "Info", "Share" and "Clear canvas" buttons > Added option to remove background image > Added dark mode functionality > Major changes 1. Boosted performance 2. Improved accessibility 3. Cleaned code > Changed background-color for PWA > Totally revamped the service worker > Updated the webpage for Thumbnail-Maker
- Loading branch information
Showing
7 changed files
with
556 additions
and
417 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,43 @@ | ||
self.addEventListener("install", function(event) { | ||
event.waitUntil( | ||
caches.open("Cub'sContraption").then(function(cache) { | ||
return cache.addAll([ | ||
"./style.css", | ||
"./script.js", | ||
"../Resources/Hermitcraft Logos/HC7 Logo.png", | ||
"https://fonts.googleapis.com/icon?family=Material+Icons" | ||
]); | ||
}) | ||
); | ||
}); | ||
function precache() { | ||
caches.open("CubsContraption").then(function (cache) { | ||
return cache.addAll([ | ||
"./style.css", | ||
"./script.js", | ||
"./index.html", | ||
"./manifest.webmanifest", | ||
"../Resources/Hermitcraft Logos/HC7 Logo.png", | ||
"https://fonts.googleapis.com/icon?family=Material+Icons" | ||
]); | ||
}) | ||
} | ||
|
||
function fromCache(request) { | ||
return caches.open("CubsContraption").then(function (cache) { | ||
return cache.match(request).then(function (matching) { | ||
return matching || Promise.reject('no-match'); | ||
}); | ||
}); | ||
} | ||
|
||
function update(request) { | ||
return caches.open("CubsContraption").then(function (cache) { | ||
return fetch(request).then(function (response) { | ||
return cache.put(request, response); | ||
}); | ||
}); | ||
} | ||
|
||
self.addEventListener("install", function (event) { | ||
console.log("SW is installing."); | ||
event.waitUntil(precache()) | ||
}) | ||
|
||
self.addEventListener("activate", event => { | ||
console.log("Inside the activate handler:", event); | ||
}); | ||
|
||
self.addEventListener("fetch", event => { | ||
console.log("Inside the fetch handler:", event); | ||
}); | ||
console.log("SW is being fetched."); | ||
event.respondWith(fromCache(event.request)); | ||
update(event.request); | ||
}); |
Oops, something went wrong.