Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sam Burba
committed
Aug 9, 2019
1 parent
342cefb
commit 1b15351
Showing
10 changed files
with
482 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"short_name": "gooodjob", | ||
"name": "Good job, team!", | ||
"icons": [ | ||
{ | ||
"src": "/static/party-icon-192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "/static/party-icon-512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": "/", | ||
"background_color": "#2a3340", | ||
"display": "standalone", | ||
"scope": "/", | ||
"theme_color": "#2a3340" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
import "./styles.css"; | ||
import "./motivational_sentence.js"; | ||
import "./prompt_add_to_homescreen.js"; | ||
|
||
if ('serviceWorker' in navigator) { | ||
window.addEventListener('load', function() { | ||
const sw = 'sw.js'; | ||
navigator.serviceWorker.register(sw).then(function(registration) { | ||
// Registration was successful | ||
console.log('ServiceWorker registration successful with scope: ', registration.scope); | ||
}, function(err) { | ||
// registration failed :( | ||
console.log('ServiceWorker registration failed: ', err); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
window.addEventListener("beforeinstallprompt", async e => { | ||
if ( | ||
document.readyState === "complete" || | ||
document.readyState === "loaded" || | ||
document.readyState === "interactive" | ||
) { | ||
await revealAddToHomescreenBtn(e); | ||
} else { | ||
window.addEventListener("DOMContentLoaded", revealAddToHomescreenBtn); | ||
} | ||
}); | ||
|
||
async function revealAddToHomescreenBtn(beforeInstallPromptEvent) { | ||
beforeInstallPromptEvent.preventDefault(); | ||
let addToHomescreenBtn = document.getElementById("add-to-homescreen"); | ||
addToHomescreenBtn.classList.remove("hidden"); | ||
addToHomescreenBtn.addEventListener('click', async () => { | ||
addToHomescreenBtn.classList.add('hidden'); | ||
beforeInstallPromptEvent.prompt(); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.