-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
index.ts
35 lines (29 loc) · 919 Bytes
/
index.ts
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
import Log from '@libs/Log';
import {VisibilityStatus} from './types';
function resolveAfter(delay: number): Promise<void> {
return new Promise<void>((resolve) => setTimeout(resolve, delay));
}
function hide(): Promise<void> {
Log.info('[BootSplash] hiding splash screen', false);
return document.fonts.ready.then(() => {
const splash = document.getElementById('splash');
if (splash) {
splash.style.opacity = '0';
}
return resolveAfter(250).then(() => {
if (!splash?.parentNode) {
return;
}
splash.parentNode.removeChild(splash);
});
});
}
function getVisibilityStatus(): Promise<VisibilityStatus> {
return Promise.resolve(document.getElementById('splash') ? 'visible' : 'hidden');
}
export default {
hide,
getVisibilityStatus,
logoSizeRatio: 1,
navigationBarHeight: 0,
};