diff --git a/css/style.css b/css/style.css index c68a96c..f79d921 100644 --- a/css/style.css +++ b/css/style.css @@ -4,6 +4,10 @@ body { font-size: 3vh; } +code { + font-size: 3vh; +} + br { clear: both; } @@ -63,8 +67,23 @@ slide-deck img.expandable:hover { max-height: 80vh; } +div.card { + margin: 0.5em; + padding: 1.0em; + float: left; + text-align: center; + border: solid 2px darkgreen; + background: lightcyan; + width: 18vw; + height: 12vh; +} + +div.card span { + height: 12vh; +} + @media only screen and (max-width: 800px) { - body { + body, code { font-size: 14px; } button, input { @@ -74,10 +93,13 @@ slide-deck img.expandable:hover { label > div, input { width: 90vw; } + div.card { + width: 80vw; + } } @media only screen and (max-width: 1200px) { - body { + body, code { font-size: 2vh; } button, input { @@ -123,6 +145,7 @@ img { .center { text-align: center; + vertical-align: middle; } slide-deck > div { diff --git a/images/triad.png b/images/triad.png new file mode 100644 index 0000000..3b53d0b Binary files /dev/null and b/images/triad.png differ diff --git a/pwa.js b/pwa.js index 6bd76b5..993002e 100644 --- a/pwa.js +++ b/pwa.js @@ -33,7 +33,7 @@ class Pwa { * Cache version * @type {number} */ - this.CACHE_VERSION = 1.0; + this.CACHE_VERSION = 1.2; /** * Pre-emptive files to cache * @type {string[]} @@ -181,24 +181,26 @@ class Pwa { this.scope.addEventListener('fetch', event => { event.respondWith( caches.open(this.CACHE_NAME).then(async cache => { - const response = await cache.match(event.request); - if (response) { - // found it, see if expired - const headers = response.headers.entries(); - let date = null; - for (let pair of headers) { - if (pair[0] === 'date') { - date = new Date(pair[1]); - break; + if (!event.request.url.startsWith("http://localhost")) { + const response = await cache.match(event.request); + if (response) { + // found it, see if expired + const headers = response.headers.entries(); + let date = null; + for (let pair of headers) { + if (pair[0] === 'date') { + date = new Date(pair[1]); + break; + } + } + if (!date) { + return response; + } + const age = parseInt(((new Date().getTime() - date.getTime()) / 1000).toString()); + const ttl = this.getTTL(event.request.url); + if (ttl === null || (ttl && age < ttl)) { + return response; } - } - if (!date) { - return response; - } - const age = parseInt(((new Date().getTime() - date.getTime()) / 1000).toString()); - const ttl = this.getTTL(event.request.url); - if (ttl === null || (ttl && age < ttl)) { - return response; } } // not found or expired, fresh request diff --git a/slides/080-why.html b/slides/080-why.html index 6376a81..051841f 100644 --- a/slides/080-why.html +++ b/slides/080-why.html @@ -1,8 +1,10 @@
var x = 1;+
+// local scope +for (let x = 1; x < 100; x+=1) {...} +var y = 1; +function process(inp) { + let y = inp * 2; + return y; +} +process(y); ++
+// constants +const x = 1; +x = 2; // 💣 BOOM! ++
+var solarsystem = { + planets: ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', + 'Saturn', 'Uranus', 'Neptune', 'Pluto (?)'], + showPlanets: function() { + this.planets.forEach(function(planet, idx) { + console.log(this.planets[idx]); + }) + } +}; +solarsystem.showPlanets(); // crash! ⛔ ++
+var solarsystem = { + planets: ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', + 'Saturn', 'Uranus', 'Neptune', 'Pluto (?)'], + showPlanets: function() { + this.planets.forEach((planet, idx) => { + console.log(this.planets[idx]); + }) + } +}; +solarsystem.showPlanets(); // success! 🌍 +\ No newline at end of file