38
BUILDING OFFLINE WEB APPS 2 case studies XConf | September 2014

Building offline web applications

Embed Size (px)

DESCRIPTION

In today's mobile-enabled world, the ability for apps to work offline is a frequent ask. There are several approaches that can be taken to achieve this depending on the scenario. In this talk, Birgitta and Rob will discuss what is meant by offline, explore some patterns for offline working from their own experience and discuss some of the things to consider.

Citation preview

Page 1: Building offline web applications

BUILDING OFFLINE WEB APPS

2 case studies

X C o n f | S e p t e m b e r 2 0 1 4

Page 2: Building offline web applications

OFFLINE?!!

2

Page 3: Building offline web applications

3

Page 4: Building offline web applications

SUPERMARKET

Java, Oracle Commodity Tablets Chrome, JavaScript

Stock Ordering System

Page 5: Building offline web applications

5

Page 6: Building offline web applications

6

Page 7: Building offline web applications

Update  Order    

Quantity:  5  Product:  34273  

Page 8: Building offline web applications

Queue

8

Update  Order    

Quantity:  5  Product:  34273  

Update Order!!

Quantity: 5!Product: 34273!

Update Order!!

Quantity: 5!Product: 34273!

Update Order!!

Quantity: 5!Product: 34273!

Update  Order    

Quantity:  5  Product:  34273  

Page 9: Building offline web applications

Queue

9

Update  Order    

Quantity:  5  Product:  34273  

Update Order!!

Quantity: 5!Product: 34273!

Update Order!!

Quantity: 5!Product: 34273!

Update Order!!

Quantity: 5!Product: 34273!

Update  Order    

Quantity:  5  Product:  34273  Message Processor

Page 10: Building offline web applications

Queue

10

Update  Order    

Quantity:  5  Product:  34273  

Update Order!!

Quantity: 5!Product: 34273!

Update Order!!

Quantity: 5!Product: 34273!

Update Order!!

Quantity: 5!Product: 34273!

Update  Order    

Quantity:  5  Product:  34273  Message Processor

Page 11: Building offline web applications

11

//  Store  localStorage.town  =  "Hamburg";    //  Retrieve  alert(localStorage.town);  

5MB+

Web Storage

Page 12: Building offline web applications

<<<<<<<  HEAD    Hamburg  is  better  than  Manchester  =======    Manchester  is  better  than  Hamburg  >>>>>>>  d237ef28dc3fab5dcccc63f580bfa7780f  

Page 13: Building offline web applications

13

Page 14: Building offline web applications

14

Page 15: Building offline web applications

TRAVELLING PRODUCT TESTER

Page 16: Building offline web applications

16

Page 17: Building offline web applications

js  html  css  

APPCACHE

Page 18: Building offline web applications

js  html  css  

APPCACHE

Page 19: Building offline web applications

js  html  css  

APPCACHE

Page 20: Building offline web applications

js  html  css  

v.254

APPCACHE

Page 21: Building offline web applications

 1  <!doctype  html>    2  <html  ...  manifest="cache.manifest">  

 1  CACHE  MANIFEST    2  #  rev  12  -­‐  2014-­‐09-­‐22T15:28:08.540Z            4  CACHE:    5  404.html    6  favicon.ico    7  scripts/scripts.js    8  scripts/vendor.js    9  styles/application.css  10  index.html    12  NETWORK:  13  *    15  FALLBACK:  16  /  /offline.html  

Page 22: Building offline web applications

Update  Order    

Quantity:  5  Product:  34273  

{      "uid":  "aaaaaaaa-­‐bbbb-­‐cccc-­‐dddd-­‐eeeeeeeeeeee",      "meta":  {...},      "title":  "Quality  sample  XYZ",      "image":  "aaaaaaaa-­‐bbbb-­‐cccc-­‐dddd-­‐eeeeeeeeeeee.png",      "content":  {          "sections":  [{              "uid":  "aaaaaaaa-­‐bbbb-­‐cccc-­‐dddd-­‐eeeeeeeeeeee"              "comments":  [],              "title":  "A  block  title",              "blocks":  [{                  "uid":  "aaaaaaaa-­‐bbbb-­‐cccc-­‐dddd-­‐eeeeeeeeeeee",                  "title":  "Material  -­‐  Lining",                  "type":  "MATERIAL”,                  "colours":  [                      {                          "code":  "18-­‐3015  TPX",                          "colourName":  "Amethyst",                          "comments":  [],                          "standard":  "Pantone",                          "uid":  "aaaaaaaa-­‐bbbb-­‐cccc-­‐dddd-­‐eeeeeeeeeeee"                      }                  ],                  "compositions":  [{                      "uid":  "aaaaaaaa-­‐bbbb-­‐cccc-­‐dddd-­‐eeeeeeeeeeee"                      "comments":  [  {  text:  "thread  count  seems  off"  ],                      "group":  "Vegetable  fibres",                      "name":  "Cotton",                      "percentage":  100,                      "sustainability":  {  value:  “Organic”  },                  }]              }]          }]      }  }  

Page 23: Building offline web applications

23

Page 24: Building offline web applications

24

Page 25: Building offline web applications

25

MongoDB

Page 26: Building offline web applications

26

MongoDB

v.254

MongoDB

Page 27: Building offline web applications

27

MongoDB

v.254

MongoDB

Page 28: Building offline web applications

28

MongoDB

v.254

MongoDB

Page 29: Building offline web applications
Page 30: Building offline web applications

30

Page 31: Building offline web applications

Set up file system + request quota

Store file locally

Update image tag

Store file locally

Upload image

Download file from server

Download image

Upload file to server

Update image tag

<img  src="filesystem:http://192.168.50.4/        persistent/3ebc23e1-­‐10bf-­‐5b60-­‐440.jpg">  

Page 32: Building offline web applications

50% of current disk space available to browser

20% of that is the maximum available to a single web app

Page 33: Building offline web applications

OR ?

Page 34: Building offline web applications

Size of data?

Amount of functionality to work offline?

Which browsers required? Structure of data?

Potential for data conflicts? Sensitive data?

OR ?

Page 35: Building offline web applications

Challenge Requirements

Page 36: Building offline web applications

Offline first and early

Page 37: Building offline web applications

Explore the possibilities

37

Page 38: Building offline web applications

THANK YOU

BIRGITTA @birgitta410

ROB @robmiles0