Skip to content

Instantly share code, notes, and snippets.

View kimuradev's full-sized avatar

kimuradev kimuradev

View GitHub Profile
@kimuradev
kimuradev / index.html
Last active July 28, 2019 01:57
PWA Medium
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Vanilla PWA</title>
<link rel="stylesheet" href="css/style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div class="flex-container">
@kimuradev
kimuradev / style.css
Last active July 28, 2019 02:01
PWA Medium
html,
body {
height: 100%;
font-family: sans-serif;
margin: 0;
}
.flex-container {
height: 100%;
display: flex;
align-items: center;
@kimuradev
kimuradev / sw.js
Created July 28, 2019 02:29
PWA Medium
var cacheName = 'vanilla-pwa';
var filesToCache = ['/', '/index.html', '/css/style.css', '/js/main.js'];
/* Start the service worker and cache all of the app's content */
self.addEventListener('install', function(e) {
e.waitUntil(
caches.open(cacheName).then(function(cache) {
return cache.addAll(filesToCache);
})
);
@kimuradev
kimuradev / main.js
Created July 28, 2019 02:44
PWA Medium
window.onload = () => {
'use strict';
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./sw.js');
}
};
@kimuradev
kimuradev / index.html
Created July 28, 2019 02:47
PWA Medium - index with main js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Vanilla PWA</title>
<link rel="stylesheet" href="css/style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div class="flex-container">
@kimuradev
kimuradev / manifest.json
Last active July 28, 2019 21:07
PWA Medium
{
"name": "Vanilla PWA",
"short_name": "PWA",
"lang": "pt-BR",
"start_url": "/index.html",
"display": "standalone",
"background_color": "white",
"theme_color": "white"
}
@kimuradev
kimuradev / manifest.json
Last active July 28, 2019 21:06
PWA Medium - manifest with icons
{
"name": "Vanilla PWA",
"short_name": "PWA",
"lang": "pt-BR",
"start_url": "/index.html",
"display": "standalone",
"background_color": "white",
"theme_color": "white",
"icons": [
{
@kimuradev
kimuradev / index.html
Last active September 27, 2019 17:34
PWA Medium - index full
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Vanilla PWA</title>
<link rel="manifest" href="/manifest.json" />
<link rel="stylesheet" href="css/style.css" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="images/icon/icon-152x152.png" />
<meta name="theme-color" content="white" />
@kimuradev
kimuradev / AndroidManifest.xml
Last active August 2, 2019 13:01
PWA Medium - Android Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.heroku.vanilla-pwa">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/appName"
android:supportsRtl="true"
android:theme="@style/Theme.LauncherActivity">
@kimuradev
kimuradev / build.gradle
Last active August 3, 2019 14:47
PWA Medium - app/build.gradle
def twaManifest = [
applicationId: 'com.heroku.vanillapwa',
hostName: 'vanilla-pwa.herokuapp.com', // The domain being opened in the TWA.
launchUrl: '/', // The start path for the TWA. Must be relative to the domain.
name: 'Vanilla PWA', // The name shown on the Android Launcher.
themeColor: '#3366ff', // The color used for the status bar.
backgroundColor: '#3366ff', // The color used for the splash screen background.
enableNotifications: false // Set to true to enable notification delegation
]