Upgrade to Pro — share decks privately, control downloads, hide ads and more …

meguro.esのサイトをPWAsにしてみた+α

Fuya
June 21, 2016
730

 meguro.esのサイトをPWAsにしてみた+α

Fuya

June 21, 2016
Tweet

Transcript

  1. whoami 1 • ݹ୩จ໻ (Fumiya FURUYA) • גࣜձࣾυϦίϜ • ৽ଔ2೥໨

    • ιʔγϟϧήʔϜͷ αʔόʔαΠυΤϯδχΞ(rails) 2 meguro.es#4 https:/ /meguro.es
  2. Geofencing API͕Կނग़དྷͨͷ͔ Service workers are generic, event-driven, time-limited script contexts

    that run at an origin. These properties make them natural endpoints for a range of runtime services that may outlive the context of a particular document, e.g. handling push notifications, background data synchronization, responding to resource requests from other origins, or receiving centralized updates to expensive-to-calculate data (e.g., geolocation or gyroscope). 6 meguro.es#4 https:/ /meguro.es
  3. Geofencing APIͷ࢖͍ํ navigator.serviceWorker.register('serviceworker.js') .then((swRegistration) => { let region = new

    CircularGeofenceRegion({ name: 'arcotower', latitude: 35.631851, longitude: 139.7146477, radius: 1000 }); swRegistration.geofencing.add(region); }); 8 meguro.es#4 https:/ /meguro.es
  4. Geofencing APIͷ࢖͍ํ serviceworker.js self.ongeofenceenter = (e) => { // ͜͜Ͱ௨஌Λग़ͨ͠Γɺfetch

    (POST) Λͨ͠Γ͢Δɻ } self.ongeofenceleave = (e) => { // ͜͜Ͱ௨஌Λग़ͨ͠Γɺfetch (POST) Λͨ͠Γ͢Δɻ } 9 meguro.es#4 https:/ /meguro.es
  5. ͦ͏؆୯ʹ͸ಈ͔ͳ͍ Geofencing API • ໊લ͕มΘ͍ͬͯΔ໰୊(undefined functionͱग़Δ໰୊) • CircularGeofenceRegion -> CircularGeofencingRegion

    • swRegistration.geofencing.add -> swRegistration.geofencing.regis terRegion 10 meguro.es#4 https:/ /meguro.es
  6. υϝΠϯऔಘ • https:/ /www.meguro.es/ • es ͸εϖΠϯͷTLD! Espanyol • esυϝΠϯ͸ύεϙʔτ͕͋Ε͹ͱΕΔͷͰECMAScriptք۾

    ͷํ͸ੋඇ SSLରԠʹ͸CloudFlareΛ࢖͏ • SWsʹ͸HTTPS͕ඞਢ 22 meguro.es#4 https:/ /meguro.es