Phat Tran
software engineer
17th March, 2017 - Ho Chi Minh city
Text
😆 oh my telex 😆
modern web capabilities
to deliver an app-like experience to users
{
"short_name": "Amazing App",
"name": "Your Full Amazing App Name",
"icons": [
{
"src": "launcher-icon-3x.png",
"sizes": "144x144",
"type": "image/png"
}
],
"start_url": "index.html",
"display": "browser",
"theme_color": "#123456"
}
manifest.json
<link rel="manifest" href="/manifest.json">
index.html
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js').then(function() {
// Success
}).catch(function() {
// Fail :(
});
}
this.addEventListener('install', function(event) {
event.waitUntil(
caches.open('v1').then(function(cache) {
return cache.addAll([
'/sw/',
'/sw/index.html',
'/sw/style.css',
'/sw/app.js',
'/sw/image-list.js',
'/sw/logo.jpg',
...
]);
})
);
});
this.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(resp) {
return resp || fetch(event.request).then(function(response) {
caches.open('v1').then(function(cache) {
cache.put(event.request, response.clone());
});
return response;
});
}).catch(function() {
return caches.match('/sw/gallery/your-image.jpg');
})
);
});
{
"staticFileGlobs": [
"app/css/**.css",
"app/**.html",
"app/images/**.*",
"app/js/**.js"
],
"stripPrefix": "app/",
"runtimeCaching": [{
"urlPattern": "/express/style/path/(.*)",
"handler": "networkFirst"
}]
}
No address bar
Service Worker
Offline cache
Get to know about Progressive Web Apps technologies.
By using Progressive Web Apps technologies within this Hackathon time, enhance mobile user-experience of your web application.
Raise website standard in Vietnam and encourage a sharing community among web developers.
- Progressive Web Apps: bit.ly/google-pwa
- Website optimization: bit.ly/web-optimize
- Getting started: bit.ly/pwa-getting-started
- Service worker libraries: bit.ly/sw-libs
- PWA reading list: bit.ly/pwa-reading-list
This slide:
Ho Chi Minh city - March 17th, 2016
Google Mobile Hackathon
vs
Final score collect at: 6:30 pm
10 selected teams have 10 mins to prepare
Final score =
70% Lighthouse Score + 30% vote
By Phat Tran
Opening talk for Vietnam Mobile Day 2017, introducing concepts & implementation instruction of Progressive Web Apps technologies to the community