offline-first apps with webcomponents - devnexus 2017

32
DEVPIXEL OFFLINE-FIRST APPS WITH WEB COMPONENTS AMAHDY ABDELAZIZ WWW.AMAHDY.NET

Upload: amahdy-abdelaziz

Post on 19-Mar-2017

45 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Offline-first apps with WebComponents - DevNexus 2017

DEVPIXEL

O F F L I N E - F I R S T A P P S W I T H

W E B C O M P O N E N T S

A M A H D Y A B D E L A Z I Z W W W . A M A H D Y . N E T

Page 2: Offline-first apps with WebComponents - DevNexus 2017

# 1 J A V A U I F R A M E W O R K

1. 100% Java

2. Awesome UX

3. Big set of Components + Add-ons

4. Used by 40% of fortune 500 companies

5. And much more…

Vaadin

Page 3: Offline-first apps with WebComponents - DevNexus 2017

Technology

‘ C L O U D ’ I S T H E D E F A U L T

‘ M O B I L E ’ I S TA K I N G O V E R

Page 4: Offline-first apps with WebComponents - DevNexus 2017

Technology

Page 5: Offline-first apps with WebComponents - DevNexus 2017

Technology

Page 6: Offline-first apps with WebComponents - DevNexus 2017

Technology

Content Producer

Page 7: Offline-first apps with WebComponents - DevNexus 2017

Technology

Content Producer

Page 8: Offline-first apps with WebComponents - DevNexus 2017

Technology

USER

Page 9: Offline-first apps with WebComponents - DevNexus 2017
Page 10: Offline-first apps with WebComponents - DevNexus 2017

Mobile-First

Page 11: Offline-first apps with WebComponents - DevNexus 2017

Practical Test

1. Mobile-first design

2. Touch-first design

3. Coffee-first design

Page 12: Offline-first apps with WebComponents - DevNexus 2017

Mobile-First

T O U C H - F I R S T D E S I G N

L O W - R E S O U R C E S D E S I G N

O F F L I N E - F I R S T D E S I G N

M U L T I - O R I E N TAT I O N D E S I G N

Page 13: Offline-first apps with WebComponents - DevNexus 2017

Mobile-First

T O U C H - F I R S T D E S I G N

L O W - R E S O U R C E S D E S I G N

O F F L I N E - F I R S T D E S I G N

M U L T I - O R I E N TAT I O N D E S I G N

Page 14: Offline-first apps with WebComponents - DevNexus 2017

OF F L I N E - F I R S T I S T H E O N L Y W A Y T O

A C H I E V E A T R U E 1 0 0 %

A L W A Y S - O N U S E R E X P E R I E N C E . *

* A S S U M I N G T H E D E V I C E I S R E L I A B L E

Page 15: Offline-first apps with WebComponents - DevNexus 2017

Bringing Component-based Software Engineering to the Web

Page 16: Offline-first apps with WebComponents - DevNexus 2017

Templates

<template id=“my-template"> <style> ... </style> <div> <h1>Web Components</h1> <img src="/img/logo.svg"> </div> </template>

Page 17: Offline-first apps with WebComponents - DevNexus 2017

HTML Imports

<link rel="import" href="my-el.html">

Page 18: Offline-first apps with WebComponents - DevNexus 2017

Custom Elements

<my-new-element></my-new-element>

Page 19: Offline-first apps with WebComponents - DevNexus 2017

S H A D O W D O M

Page 20: Offline-first apps with WebComponents - DevNexus 2017

Before Shadow DOM

<div id="slides-to-show"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div>

<div class="data slick-initialized slick-slider" data-slick="{"slidesToShow": 4, "slidesToScroll": 4}"> <button class="slick-prev slick-arrow" role="button" aria-label="Previous" data-role="none" type="button" style="display: block;">Previous</button> <div class="slick-list draggable" aria-live="polite"> <div class="slick-track" style="opacity: 1; width: 1960px; transform: translate3d(-560px, 0px, 0px);" role="listbox"> <div class="slick-slide slick-cloned" data-slick-index="-4" aria-hidden="true" style="width: 140px;" tabindex="-1"> <div class="slick-slide slick-cloned" data-slick-index="-3" aria-hidden="true" style="width: 140px;" tabindex="-1"> <div class="slick-slide slick-cloned" data-slick-index="-2" aria-hidden="true" style="width: 140px;" tabindex="-1"> <div class="slick-slide slick-cloned" data-slick-index="-1" aria-hidden="true" style="width: 140px;" tabindex="-1"> <div class="slick-slide slick-current slick-active" data-slick-index="0" aria-hidden="false" style="width: 140px;" tabindex="-1" role="option" aria-describedby="slick-slide30"> <h3>1</h3> </div> <div class="slick-slide slick-active" data-slick-index="1" aria-hidden="false" style="width: 140px;" tabindex="-1" role="option" aria-describedby="slick-slide31"> <div class="slick-slide slick-active" data-slick-index="2" aria-hidden="false" style="width: 140px;" tabindex="-1" role="option" aria-describedby="slick-slide32"> <div class="slick-slide slick-active" data-slick-index="3" aria-hidden="false" style="width: 140px;" tabindex="-1" role="option" aria-describedby="slick-slide33"> <div class="slick-slide" data-slick-index="4" aria-hidden="true" style="width: 140px;" tabindex="-1" role="option" aria-describedby="slick-slide34"> <div class="slick-slide" data-slick-index="5" aria-hidden="true" style="width: 140px;" tabindex="-1" role="option" aria-describedby="slick-slide35"> <div class="slick-slide slick-cloned" data-slick-index="6" aria-hidden="true" style="width: 140px;" tabindex="-1"> <div class="slick-slide slick-cloned" data-slick-index="7" aria-hidden="true" style="width: 140px;" tabindex="-1"> <div class="slick-slide slick-cloned" data-slick-index="8" aria-hidden="true" style="width: 140px;" tabindex="-1"> <div class="slick-slide slick-cloned" data-slick-index="9" aria-hidden="true" style="width: 140px;" tabindex="-1"> </div> </div> <button class="slick-next slick-arrow" role="button" aria-label="Next" data-role="none" type="button" style="display: block;">Next</button> </div>

1 2 3 4

Page 21: Offline-first apps with WebComponents - DevNexus 2017

With Shadow DOM

1 2 3 4 1 2 3 4

<div id="slides-to-show"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div>

<div id="slides-to-show"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> </div>

Page 22: Offline-first apps with WebComponents - DevNexus 2017
Page 23: Offline-first apps with WebComponents - DevNexus 2017

• Encapsulation

• Reusability

Benefits of using Web Components

Page 24: Offline-first apps with WebComponents - DevNexus 2017

Browser Support

Chrome Opera Firefox Safari IE/Edge

~c g ~ ~

~* As of December 2016

Page 25: Offline-first apps with WebComponents - DevNexus 2017

Web Components Polyfill

IE10 IE11+ Chrome* Firefox* Safari 7+*Chrome Android*

Mobile Safari*

Custom Elements ~HTML Imports ~Shadow DOM

Templates

Page 26: Offline-first apps with WebComponents - DevNexus 2017
Page 27: Offline-first apps with WebComponents - DevNexus 2017

•Angular •Polymer •React •Framework.JS

Page 28: Offline-first apps with WebComponents - DevNexus 2017

Solution

C A S H I N G

F I R E B A S E

O F F L I N E S T O R A G E

D ATA R E P L I C AT I O N

Page 29: Offline-first apps with WebComponents - DevNexus 2017
Page 30: Offline-first apps with WebComponents - DevNexus 2017
Page 31: Offline-first apps with WebComponents - DevNexus 2017

Challenges

I N I T I A L L O A D T I M E

S E C U R I T Y O F S T O R E D D ATA

R A C E C O N D I T I O N

Page 32: Offline-first apps with WebComponents - DevNexus 2017

D E M O A P P

https://github.com/amahdy/offline-first-app

<Links> T H A N K Y O U ! - B U D D H A