|* Always start with a brief, one-line description of the script.|
|* If more than one line is needed to describe the script, provide more detailed|
|* comment text following a blank comment line.|
|// Use an IIFE (immediately invoked function expression) to encapsulate your|
|// script from other scripts loaded on the page and to prevent pollution of the|
|// global namespace.|
ServiceWorker for github pages
This is a ServiceWorker template to turn small github pages into offline ready app.
Whenever I make small tools & toys, I create github repo and make a demo page using github pages (like this one).
Often these "apps" are just an
html/css/js files). I wanted to cache these files so that I can access my tools offline as well.
Make sure your github pages have HTTPS enforced, you can check
Settings > GitHub Pages > Enforce HTTPS of your repository.
reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and