Skip to content

Instantly share code, notes, and snippets.

View jgw96's full-sized avatar
:octocat:
Building PWAs

Justin Willis jgw96

:octocat:
Building PWAs
View GitHub Profile
{
"hasSW": "https://www.pinterest.com/sw.js?_ngjs=1",
"scope": "https://www.pinterest.com/",
"pushReg": null,
"cache": [
{
"fromSW": false,
"requestURL": "https://www.pinterest.com/resource/UserRegisterTrackActionResource/update/"
},
{
export async function getUser(token: string) {
const headers = new Headers();
const bearer = "Bearer " + token;
headers.append("Authorization", bearer);
const options = {
method: "GET",
headers: headers
};
const graphEndpoint = "https://graph.microsoft.com/beta/me";
if ('serviceWorker' in navigator && location.protocol !== 'file:') {
window.addEventListener('load', function(){
navigator.serviceWorker.register('/sw.js')
.then(function(reg) {
reg.addEventListener('updatefound', function() {
const toast = document.createElement('div');
toast.innerHTML = '<button>Update available</button>';
document.body.appendChild(toast);
})
@jgw96
jgw96 / README.md
Created June 21, 2017 19:57
conf app edited readme

Ionic Conference Application

This is purely a demo of Ionic with TypeScript. It is still in development.

Important!

There is not an actual Ionic Conference at this time. This project is just to show off Ionic components in a real-world application. Please go through the steps in CONTRIBUTING.md before submitting an issue.

Table of Contents

// Implements stale-while-revalidate
self.addEventListener('fetch', event => {
const cached = caches.match(event.request);
const fetched = fetch(event.request);
// Call respondWith() with whatever we get first.
// If the fetch fails (e.g disconnected), wait for the cache.
// If there’s nothing in cache, wait for the fetch.
// If neither yields a response, return a 404.
event.respondWith(