modify publick curriculum
This commit is contained in:
+24
-1
@@ -12,6 +12,9 @@ import https from 'https'
|
||||
|
||||
let mainWindow: BrowserWindow | null = null
|
||||
let splashWindow: BrowserWindow | null = null
|
||||
const MIN_SPLASH_VISIBLE_MS = 2000
|
||||
let splashVisibleStartedAt = 0
|
||||
let splashCloseTimer: NodeJS.Timeout | null = null
|
||||
const terminalProcesses = new Map<string, ChildProcessWithoutNullStreams>()
|
||||
const terminalStopTimers = new Map<string, NodeJS.Timeout>()
|
||||
const intentionalTerminalStops = new Set<string>()
|
||||
@@ -3176,8 +3179,16 @@ function createSplashWindow(): void {
|
||||
}
|
||||
})
|
||||
|
||||
splashWindow.once('ready-to-show', () => splashWindow?.show())
|
||||
splashVisibleStartedAt = Date.now()
|
||||
splashWindow.once('ready-to-show', () => {
|
||||
splashVisibleStartedAt = Date.now()
|
||||
splashWindow?.show()
|
||||
})
|
||||
splashWindow.on('closed', () => {
|
||||
if (splashCloseTimer) {
|
||||
clearTimeout(splashCloseTimer)
|
||||
splashCloseTimer = null
|
||||
}
|
||||
splashWindow = null
|
||||
})
|
||||
splashWindow.loadFile(join(__dirname, '../renderer/splash.html')).catch((error) => {
|
||||
@@ -3194,6 +3205,18 @@ function updateSplashStatus(message: string): void {
|
||||
}
|
||||
|
||||
function closeSplashAndShowMain(): void {
|
||||
if (splashCloseTimer) return
|
||||
const elapsed = splashVisibleStartedAt ? Date.now() - splashVisibleStartedAt : MIN_SPLASH_VISIBLE_MS
|
||||
const remaining = Math.max(0, MIN_SPLASH_VISIBLE_MS - elapsed)
|
||||
|
||||
if (remaining > 0) {
|
||||
splashCloseTimer = setTimeout(() => {
|
||||
splashCloseTimer = null
|
||||
closeSplashAndShowMain()
|
||||
}, remaining)
|
||||
return
|
||||
}
|
||||
|
||||
if (mainWindow && !mainWindow.isDestroyed() && !mainWindow.isVisible()) {
|
||||
splashWindow?.close()
|
||||
splashWindow = null
|
||||
|
||||
Reference in New Issue
Block a user