Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View FezVrasta's full-sized avatar
:electron:

Federico Zivolo FezVrasta

:electron:
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<style>
body {
display: flex;
}
.push {
width: 2000px;
window.addEventListener('error', async err => {
// Since we are handling the error here, we must make
// sure we log it into the console nonetheless, otherwise
// it will be very difficult to understand why your app
// is crashing.
console.error(err);
// If no service worker is available, our work ends here
// because we don't need to unregister the service worker
// to make sure the user is able to get a newer version of
serviceWorker.register({
onUpdate: registration => {
setWaitingServiceWorker(registration.waiting);
setUpdateAvailable(true);
},
onWaiting: waiting => {
setWaitingServiceWorker(waiting);
setUpdateAvailable(true);
}
});
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
// WE ADD THE CODE BELOW
if (registration.waiting) {
if (config && config.onWaiting) {
config.onWaiting(registration.waiting);
}
}
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
// WE ADD THE CODE BELOW
if (registration.waiting) {
if (config && config.onWaiting) {
config.onWaiting(registration.waiting);
}
}
import { ServiceWorkerProvider, useServiceWorker } from './useServiceWorker';
const App = () => {
const { isUpdateAvailable, updateAssets } = useServiceWorker();
return (
<div>
Hello, World!
{isUpdateAvailable && (
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
const ServiceWorkerContext = React.createContext();
export const ServiceWorkerProvider = ({ children }) => {
const [waitingServiceWorker, setWaitingServiceWorker] = useState(null);
const [isUpdateAvailable, setUpdateAvailable] = useState(false);
React.useEffect(() => {
serviceWorker.register({
onUpdate: registration => {
setWaitingServiceWorker(registration.waiting);
const [waitingServiceWorker, setWaitingServiceWorker] = useState(null);
const [isUpdateAvailable, setUpdateAvailable] = useState(false);
React.useEffect(() => {
serviceWorker.register({
onUpdate: registration => {
setWaitingServiceWorker(registration.waiting);
setUpdateAvailable(true);
}
});
@FezVrasta
FezVrasta / privacy-policy.md
Created September 18, 2018 12:00
Notifications for GitHub privacy policy

Notifications for GitHub privacy policy

Notifications for GitHub (the application) doesn't directly collect or share any user information without the explicit consent of the user.

To use the application, the user is required to login with their own GitHub, Inc. account,
the authentication process is directly handled by GitHub and no informations are collected by the application.

In order to use the notifications system, the user is required to login to (or create an account with) ZEIT, Inc's Now.sh service.
The authentication is directly handled by ZEIT and no informations are collected by the application.
A GitHub token will be stored in the user's ZEIT Now.sh account in order to collect the notifications and send them to the push notification system of