mirror of
https://github.com/pavlobu/deskreen.git
synced 2025-06-01 23:30:09 -07:00
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
export default (
|
|
params: handleDisplayingLoadingSharingIconLoopParams
|
|
) => {
|
|
const {
|
|
promptStep,
|
|
url,
|
|
setIsShownLoadingSharingIcon,
|
|
loadingSharingIconType,
|
|
isShownLoadingSharingIcon,
|
|
setLoadingSharingIconType,
|
|
} = params;
|
|
return () => {
|
|
let interval: NodeJS.Timeout;
|
|
if (promptStep === 3 && url === undefined) {
|
|
setIsShownLoadingSharingIcon(true);
|
|
|
|
let currentIcon = loadingSharingIconType;
|
|
let isShownIcon = isShownLoadingSharingIcon;
|
|
let isShownWithFadingUIEffect = false;
|
|
interval = setInterval(() => {
|
|
isShownIcon = !isShownIcon;
|
|
setIsShownLoadingSharingIcon(isShownIcon);
|
|
if (isShownWithFadingUIEffect) {
|
|
currentIcon = currentIcon === 'desktop' ? 'application' : 'desktop';
|
|
setLoadingSharingIconType(currentIcon);
|
|
isShownWithFadingUIEffect = false;
|
|
} else {
|
|
isShownWithFadingUIEffect = true;
|
|
}
|
|
}, 1500);
|
|
}
|
|
|
|
return () => {
|
|
clearInterval(interval);
|
|
};
|
|
};
|
|
};
|