INNER CODE UNIT · TypeScript
setDownloadPercent
elie222/inbox-zero · apps/desktop/src/main.ts:353
function setDownloadPercent(percent: number | null) {
downloadPercent = percent;
refreshDesktopMenu?.();
syncUpdateProgressBar();
}
function syncUpdateProgressBar() {
const onView = windows.some(
(window) => window.isFocused() && window.isVisible(),
);
const progress =
downloadPercent === null || !onView
? -1
: Math.min(1, Math.max(0, downloadPercent / 100));
for (const window of windows) {
if (!window.isDestroyed()) window.setProgressBar(progress);
}
}