-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommon_load.js
More file actions
37 lines (31 loc) · 838 Bytes
/
Copy pathcommon_load.js
File metadata and controls
37 lines (31 loc) · 838 Bytes
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
let okSound = null;
let ngSound = null;
{
let isFontLoaded = false;
let isSoundLoaded = false;
Promise.all([
loadSound("asset/ピコン.mp3"),
loadSound("asset/プホッ.mp3"),
]).then((result) => {
isSoundLoaded = true;
okSound = result[0];
ngSound = result[1];
endIfEnd();
});
document.fonts.onloadingdone = () => {
isFontLoaded = true;
endIfEnd();
};
document.fonts.ready.then(() => {
isFontLoaded = true;
endIfEnd();
});
function endIfEnd() {
if (isFontLoaded && isSoundLoaded) {
const $load = document.querySelector("#common-load");
const $app = document.querySelector("#app");
$load.style.display = "none";
$app.style.display = "";
}
}
}