-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
38 lines (31 loc) · 1.02 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {makePlayerApp} from './app.js';
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js').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);
});
});
}
function ready(eventHandler){
if (document.readyState !== 'loading') {
eventHandler();
} else {
document.addEventListener('DOMContentLoaded', eventHandler);
}
}
// ****** Init ******
async function init(){
const response = await fetch('https://script.google.com/macros/s/AKfycbyZ8X6XntBJZC5s_0eT08NHan8c1n_htRj_cyxMAuExzrTGDds/exec');
const data = await response.json();
console.log(data);
$('#wait-layer').hide();
makePlayerApp('#saint_app', data);
}
/********************
***** READY *********
*********************/
ready(init);