|
1 | 1 | import React, {Component} from 'react'; |
2 | 2 | import Note from '../Note'; |
3 | | -import appShell from './app-shell.png'; |
| 3 | +import appShellImg from './app-shell.png'; |
4 | 4 | import appOffline from './offline-app.png'; |
| 5 | +import cachedResources from './cached-resources.png'; |
5 | 6 |
|
6 | | -class Offline extends Component { |
| 7 | +class AppShell extends Component { |
7 | 8 | render() { |
8 | 9 | return( |
9 | 10 | <div className="offline"> |
10 | | - <h1>Offline</h1> |
11 | | - <p>Making an application to work in offline is powerful feature. By following app shell architecture, we can achieve fast and more reliable user interface.</p> |
12 | | - |
13 | | - <h2>What is App Shell Architecture?</h2> |
14 | | - <p>An app shell architecture is minimal level <span className="hightlight bold no--bg">HTML, CSS, Javascript</span> required to show the application user interface. By caching the app shell, application loads fast and repeated visits loads even faster.</p> |
15 | | - |
| 11 | + <h1>What is App Shell Architecture?</h1> |
| 12 | + <p>An app shell architecture is minimal level <span className="hightlight bold no--bg">HTML, CSS, Javascript</span> required to show the application user interface. By caching the app shell, application loads faster on the initial load and even faster on repeated visits.</p> |
| 13 | + |
16 | 14 | <i>Note: To save some coding time, App shell is already added to the codelabs sample repository.</i> |
17 | 15 |
|
18 | 16 | <div className="offline__container"> |
19 | | - <img src={appShell} alt="app shell" /> |
| 17 | + <img src={appShellImg} alt="app shell" /> |
20 | 18 | </div> |
21 | 19 |
|
22 | 20 | <Note type="facts"> |
23 | 21 | <p><span>Facts: </span> Housing.com used app shell architecture in their <a href="housing.com" target="_blank">progressive web app</a> to load the page 30% faster than before. Read thier full <a href="https://developers.google.com/web/showcase/2016/pdfs/housing.pdf" target="_blank">case study</a>.</p> |
24 | 22 | </Note> |
| 23 | + |
| 24 | + <h2>Offline</h2> |
| 25 | + <p>Service worker allow us to use cache API to cache the resources and thus by providing offline experience.</p> |
25 | 26 |
|
26 | | - <p>Let the user know when he goes offline is an important feature.</p> |
27 | | - |
| 27 | + <i>Note: Resources cached via cache API can be view in application tab in chrome DevTools. Refer the below image.</i> |
| 28 | + |
| 29 | + <div className="offline__container"> |
| 30 | + <img className="" src={cachedResources} alt="cached resources" /> |
| 31 | + </div> |
| 32 | + |
| 33 | + <p>More details about <a href="https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage">Cache API</a>.</p> |
| 34 | + |
| 35 | + <h2>Taking advantage of built-in events</h2> |
| 36 | + |
28 | 37 | <div className="offline__container"> |
29 | 38 | <img className="" src={appOffline} alt="app offline" /> |
30 | 39 | </div> |
| 40 | + |
31 | 41 | </div> |
32 | 42 | ); |
33 | 43 | } |
34 | 44 | } |
35 | 45 |
|
36 | | -export default Offline; |
| 46 | +export default AppShell; |
0 commit comments