mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
26 lines
820 B
TypeScript
26 lines
820 B
TypeScript
import { useEffect } from 'react';
|
|
|
|
export function useAppLoadingScreen() {
|
|
useEffect(() => {
|
|
const appLoadingScreen = document.getElementById('app-loading-screen');
|
|
if (!appLoadingScreen) {
|
|
console.warn('Can"t find any node with "app-loading-screen" id');
|
|
return;
|
|
}
|
|
|
|
if (appLoadingScreen.classList.contains('app-loading-screen--fade-out')) {
|
|
console.warn('#app-loading-screen already has "app-loading-screen--fade-out" class');
|
|
return;
|
|
}
|
|
|
|
const onTransitionEnd = () => {
|
|
appLoadingScreen.style.display = 'none';
|
|
};
|
|
|
|
appLoadingScreen.addEventListener('transitionend', onTransitionEnd);
|
|
appLoadingScreen.classList.add('app-loading-screen--fade-out');
|
|
|
|
return () => appLoadingScreen.removeEventListener('transitionend', onTransitionEnd);
|
|
}, []);
|
|
}
|