• No results found

Offline Sync for Progressive Web Apps

N/A
N/A
Protected

Academic year: 2021

Share "Offline Sync for Progressive Web Apps"

Copied!
45
0
0

Loading.... (view fulltext now)

Full text

(1)

Offline Sync for

Progressive Web Apps

Bradley Holt

Program Manager, Developer Advocacy

Center for Open-Source Data and AI Technologies

June 13, 2018 / © 2018 IBM Corporation

(2)
(3)

iPhone 4 - Bottom View with Bumper by William Hook, on Flickr <https://flic.kr/p/8e7p2s> (CC BY-SA 2.0).

Web or

mobile

app?

(4)

http://gph.is/2dhW35c

(5)

Progressive Web Apps

Provides both the discoverability of a web app and the reliable, fast, and engaging user

experience of a native mobile app

June 13, 2018 / © 2018 IBM Corporation

(6)

https://www.pwastats.com/

(7)

https://developers.google.com/web/showcase/2017/twitter

(8)
(9)

Not just offline…

Accès wi-fi à Gorakshep (5140m) by Jerome Bon, on Flickr <https://flic.kr/p/bDzjj5> (CC BY 2.0).

(10)

Reliable, fast, and engaging user

experience—

regardless of network connectivity

Static Wallpaper by James Spinks, on Flickr <https://flic.kr/p/2b1JP> (CC BY-SA 2.0).

(11)

Zero-latency access to

content & data

speed 3 by Monkieyes, on Flickr <https://flic.kr/p/PXPwK> (CC BY 2.0).

(12)

Offline, Online & ¯\_(

)_/¯

June 13, 2018 / © 2018 IBM Corporation

(13)

The next

billion people

on the internet

the galaxy by tommy@chau, on Flickr <https://flic.kr/p/sbEHMt> (CC BY 2.0).

(14)

Geolocation API

Network Information API

IndexedDB

WebRTC API

Push API

Notifications API

Device Orientation API Screen Orientation API

Permissions API

Proximity API

Pointer Lock API

Vibration API

Payment Request API

Battery Status API

Ambient Light Sensor API

Service Worker API

IBM Design Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0).

June 13, 2018 / © 2018 IBM Corporation

(15)

Service Workers

Service Workers allow for fine- grained control over caching of

content and assets, enabling cache-first web apps

Service Workers fetch diagram by Mozilla Contributors <https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers> (CC-BY-SA 2.5).

June 13, 2018 / © 2018 IBM Corporation

(16)

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

(17)

Registering a service worker example by Mozilla Contributors <https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers> (CC-BY-SA 2.5).

(18)

Install and activate a service worker example by Mozilla Contributors <https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers> (CC-BY-SA 2.5).

(19)

Custom service worker response example by Mozilla Contributors <https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers> (CC-BY-SA 2.5).

(20)

IndexedDB

IndexedDB enables app data to be

stored locally within a browser

IBM Design Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0).

June 13, 2018 / © 2018 IBM Corporation

(21)

https://caniuse.com/#search=indexdb

(22)

localForage

localForage wraps IndexedDB,

WebSQL, or localStorage, providing a

consistent API

regardless of which storage mechanism is supported by the end user’s browser

IBM Design Icons by International Business Machines Corporation <https://www.ibm.com/design/language/resources/icon-library/> (CC BY 4.0).

June 13, 2018 / © 2018 IBM Corporation

(23)

https://github.com/localForage/localForage

(24)

Sync is Hard

Technological devices designed by D3Images / Freepik <http://www.freepik.com/>.

June 13, 2018 / © 2018 IBM Corporation

(25)
(26)

Apache CouchDB PouchDB

IBM Cloudant

June 13, 2018 / © 2018 IBM Corporation

(27)

“CouchDB’s superpower is sync.

Sometimes I even try to explain it to people by saying, ‘CouchDB isn’t a database; it’s a sync engine.’ It’s a way of efficiently transferring data from one place to another, while

intelligently managing conflicts and revisions. It’s very similar to Git.

When I make that analogy, the light bulb often goes off.”

Nolan Lawson

PouchDB & CouchDB: An interview with Nolan Lawson

June 13, 2018 / © 2018 IBM Corporation

https://blog.couchdb.org/2017/04/04/pouchdb-couchdb-an-interview-with-nolan-lawson/

(28)

Offline Sync for Progressive

Web Apps

PouchDB

Devices by Darwin Laganzon, on Pixabay <https://pixabay.com/photo-1917227/> (CC0 Public Domain). | Cloud by Raphael Silva, on Pixabay <https://pixabay.com/photo-2109664/> (CC0 Public Domain).

June 13, 2018 / © 2018 IBM Corporation

Apache CouchDB

(29)

https://pouchdb.com/

(30)

Pokedex.org

An offline-capable Progressive Web App built with

Service Worker and PouchDB

https://www.pokedex.org/

June 13, 2018 / © 2018 IBM Corporation

(31)

Multi-User Apps with Hoodie

http://hood.ie/

June 13, 2018 / © 2018 IBM Corporation

(32)

June 13, 2018 / © 2018 IBM Corporation

(33)

Devices by Darwin Laganzon, on Pixabay <https://pixabay.com/photo-1917227/> (CC0 Public Domain). | Cloud by Raphael Silva, on Pixabay <https://pixabay.com/photo-2109664/> (CC0 Public Domain).

PouchDB

June 13, 2018 / © 2018 IBM Corporation

Apache CouchDB

(34)

Cloudant Envoy

June 13, 2018 / © 2018 IBM Corporation

(35)

June 13, 2018 / © 2018 IBM Corporation

(36)

Shopping List

A series of Offline First demo apps—

each built using a different stack

https://ibm-watson-data-lab.github.io/shopping-list-demo June 13, 2018 / © 2018 IBM Corporation

(37)

https://github.com/ibm-watson-data-lab/shopping-list June 13, 2018 / © 2018 IBM Corporation

(38)

https://developer.ibm.com/code/patterns/create-an-offline-first-shopping-list-progressive-web-app/

June 13, 2018 / © 2018 IBM Corporation

(39)

Join the

Offline First

community

(40)

Offline Camp

We are building an Offline First

community, one campfire at a time.

Offline Camp has visited the Catskills of New York, the

Central Coast of California, Berlin, and Oregon.

June 13, 2018 / © 2018 IBM Corporation

(41)

offlinefirst.org/chat

June 13, 2018 / © 2018 IBM Corporation

(42)
(43)

https://medium.com/offline-camp

(44)

Thank you

codait.org

twitter.com/BradleyHolt

medium.com/@BradleyHolt github.com/bradley-holt developer.ibm.com/code

June 13, 2018 / © 2018 IBM Corporation

(45)

June 13, 2018 / © 2018 IBM Corporation

References

Related documents

In polar coordinates, iris boundaries are horizontal edge points, non-iris boundary that caused by iris textures, eyelashes, eyelids, and lamp-house are not horizontal edge points..

To investigate if the simulation results have any bearing in real applications, we used the data in Arellano and Bond (1991) and re-estimated their employment equations with

The exact estimation of quantization effects requires numerical simulation and is not amenable to exact analytical methods.. But an approach that has proven useful is to treat

In this study, we use monthly prices in the major IRRI rice markets in Pakistan, whereas the free on Board (FOB) price of Thai 5% broken rice (a close substitute for IRRI rice)

Secure fi le transfer over HTTP (HTTPS) that supports single port (440) access by Web browsers (including Firefox, Internet Explorer, Mozilla, Netscape, Opera, and Safari) as well

Oransky believes CPA financial planners can help clients plan for retirement by helping them understand risk, focus on cash flow and optimize asset location within a portfolio..

Grey List Spam Home Clam Anti Virus Spam Assassin Mimedefang AddFil1 AddFil2 AddFil3 AddFil4 Cost = Hardware (20,000)+ Labor (1000 hrs) Cost = Hardware (20,000)+ Labor (1300 hrs)