Michael Holroyd
Computer Graphics Ph.D.
CVJS March 2019
Michael Holroyd, PhD
@meekohi
Tools for event organizers
Tools for event curators
Growing partner network
Hiring!
1. UX/Design
2. Front-end
https://caniuse.com/#feat=serviceworkers
cavepot.com
A service worker is a programmable network proxy.
Most important application... replace all requests for a photo with images of cats instead:
A lot of tutorials online start with caching applications, but that is just a common use case.
<!DOCTYPE html>
<h1>Holroyd is so cool...</h1>
<img src="holroyd_pilot.png"/>
<script>
navigator.serviceWorker.register('sw.js')
</script>
self.addEventListener('fetch', e => {
if(e.request.url.indexOf('.png') > -1) {
var catsRequest = new Request('https://placekitten.com/g/600/350')
e.respondWith( fetch(catsRequest) )
}
})
push / sync
.register() only if the servicer-worker.js url has changed
Ctrl+R will not refresh your service worker!
By Michael Holroyd
Presentation on Service Workers for the Central Virginia Javascript Meetup, March 2019.