service workers and apex

36
Dimitri Gielis Service Workers & APEX www.apexRnD.be dgielis.blogspot.com @dgielis [email protected]

Upload: dimitri-gielis

Post on 16-Apr-2017

752 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Service Workers and APEX

Dimitri Gielis

Service Workers & APEX

www.apexRnD.be dgielis.blogspot.com @dgielis [email protected]

Page 2: Service Workers and APEX

Dimitri Gielis

❖ Founder & CEO of APEX R&D

❖ 18+ years of Oracle Experience (OCP & APEX Certified)

❖ Oracle ACE Director

❖ “APEX Developer of the year 2009” by Oracle Magazine

❖ “Oracle Developer Choice award (ORDS)” in 2015

❖ Author Expert Oracle Application Express

❖ Presenter at Oracle Conferences (OOW, ODTUG, OGh, UKOUG, …)

Page 3: Service Workers and APEX

https://www.apexofficeprint.com

Workshop - tomorrow 4.15 pm (Jazz 1)

Page 4: Service Workers and APEX

http://dgielis.blogspot.com @dgielis

Page 5: Service Workers and APEX

Rich offline experience

Periodic background syncs

Push notifications

Geofencing

Page 6: Service Workers and APEX

Agenda

❖ What are Service Workers

❖ What do they solve

❖ Service Worker Life Cycle

❖ Example of a Service Worker

❖ Use cases in APEX

Page 7: Service Workers and APEX

Service Workers

Page 8: Service Workers and APEX

A service worker is a script that stands between

your website and the network

Page 9: Service Workers and APEX

A service worker is a script that is run by your

browser in the background, separate from a web

page, opening the door to features which don't

need a web page or user interaction.

http://www.html5rocks.com/en/tutorials/service-worker/introduction/

Page 10: Service Workers and APEX

Rich offline experience

Periodic background syncs

Push notifications

Geofencing

Page 11: Service Workers and APEX

What is a Service Worker

❖ It's a JavaScript Worker, so it can't access the DOM directly

❖ Service worker is a programmable network proxy, allowing you to control how network requests from your page are handled.

❖ It will be terminated when not in use, and restarted when it's next needed

❖ Service Workers have access to the IndexedDB API

❖ Service workers are asynchronous and make extensive use of promises

❖ Service workers require content to be served via https

Page 12: Service Workers and APEX

JavaScript Promises

❖ JavaScript is single threaded

❖ We want multithreaded

❖ Async success/failure

http://www.html5rocks.com/en/tutorials/es6/promises/

Page 13: Service Workers and APEX

JavaScript Promises

http://www.html5rocks.com/en/tutorials/es6/promises/

Page 14: Service Workers and APEX

Service Workers solve

❖ Offline usage (Offline-first)

❖ Programmable cache control

❖ Custom response

❖ Background processing

❖ Push notifications

❖ BackgroundSync

❖ Alarms (Task Scheduler)

Page 15: Service Workers and APEX
Page 16: Service Workers and APEX

Service Worker Life Cycle

Page 17: Service Workers and APEX

Register

Page 18: Service Workers and APEX

Using Service Worker

http://www.html5rocks.com/en/tutorials/service-worker/introduction/

Page 19: Service Workers and APEX

Register a Service Worker

Page 20: Service Workers and APEX

Register

Page 21: Service Workers and APEX

Install a Service Worker

Page 22: Service Workers and APEX

Register

Page 23: Service Workers and APEX

Fetch a Service Worker

Page 24: Service Workers and APEX

Register

Page 25: Service Workers and APEX

Update & Activate a Service Worker

Page 26: Service Workers and APEX

Register

Page 27: Service Workers and APEX

Viewing/Debug a Service Worker

(old: chrome://serviceworker-internals/)chrome://inspect/#service-workers

Page 28: Service Workers and APEX

Demo SW in APEX

Page 29: Service Workers and APEX

Lessons learned

❖ JavaScript knowledge important (Promise)

❖ Get sample working locally first

❖ Replicate in Oracle APEX

❖ Unregister SW and close tab

❖ Use Chrome Dev Tools to debug

Page 30: Service Workers and APEX

Browser Support?

Page 31: Service Workers and APEX

Browser Support

http://caniuse.com/#feat=serviceworkers

Page 32: Service Workers and APEX

Browser Support

https://jakearchibald.github.io/isserviceworkerready/

Page 33: Service Workers and APEX

References

❖ https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API

❖ http://www.html5rocks.com/en/tutorials/service-worker/introduction/

❖ https://www.talater.com/upup/?utm_source=the-webdesigner.co&utm_medium=newsletter

❖ https://www.smashingmagazine.com/2016/02/making-a-service-worker/

❖ https://css-tricks.com/serviceworker-for-offline/

❖ https://developers.google.com/web/fundamentals/getting-started/

❖ https://aarontgrogg.com/blog/2015/07/20/the-difference-between-service-workers-web-workers-and-websockets/

❖ https://jakearchibald.github.io/isserviceworkerready/

Page 34: Service Workers and APEX

Recap

❖ What are Service Workers

❖ What do they solve

❖ Service Worker Life Cycle

❖ Example of a Service Worker

❖ Use cases in APEX

Page 35: Service Workers and APEX

Q&A www.apexRnD.be dgielis.blogspot.com @dgielis [email protected]

Page 36: Service Workers and APEX

❖ Looking for consulting, training and development in Oracle Application Express (APEX)?

❖ Contact : www.apexRnD.be

❖ Mail : [email protected]

Consulting, Development, Training