fix(stage-tamagotchi): should register handlers before window load
Co-authored-by: Lovehsigure_520 <62863834+Neko-233@users.noreply.github.com>
This commit is contained in:
co-authored by
Lovehsigure_520
parent
99bb1eaddd
commit
e86ee2f135
@@ -39,8 +39,6 @@ export function setupAboutWindowReusable(params: {
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/about'))
|
||||
|
||||
await setupAboutWindowElectronInvokes({
|
||||
window,
|
||||
autoUpdater: params.autoUpdater,
|
||||
@@ -48,6 +46,8 @@ export function setupAboutWindowReusable(params: {
|
||||
serverChannel: params.serverChannel,
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/about'))
|
||||
|
||||
return window
|
||||
}).getWindow
|
||||
}
|
||||
|
||||
@@ -345,9 +345,10 @@ export function setupCaptionWindowManager(params: {
|
||||
window.on('show', emitVisibilityChanged)
|
||||
window.on('hide', emitVisibilityChanged)
|
||||
|
||||
const cleanupGetAttached = defineInvokeHandler(context, captionGetIsFollowingWindow, async () => isFollowing)
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/caption'))
|
||||
|
||||
const cleanupGetAttached = defineInvokeHandler(context, captionGetIsFollowingWindow, async () => isFollowing)
|
||||
try {
|
||||
context.emit(captionIsFollowingWindowChanged, isFollowing)
|
||||
}
|
||||
|
||||
@@ -38,8 +38,6 @@ export function setupChatWindowReusableFunc(params: {
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/chat'))
|
||||
|
||||
await setupChatWindowElectronInvokes({
|
||||
window,
|
||||
widgetsManager: params.widgetsManager,
|
||||
@@ -48,6 +46,8 @@ export function setupChatWindowReusableFunc(params: {
|
||||
i18n: params.i18n,
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/chat'))
|
||||
|
||||
return window
|
||||
}).getWindow
|
||||
}
|
||||
|
||||
@@ -132,8 +132,6 @@ export async function setupDashboardWindow(params: {
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/dashboard'))
|
||||
|
||||
await setupDashboardWindowElectronInvokes({
|
||||
window,
|
||||
settingsWindow: params.settingsWindow,
|
||||
@@ -143,6 +141,8 @@ export async function setupDashboardWindow(params: {
|
||||
serverChannel: params.serverChannel,
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/dashboard'))
|
||||
|
||||
/**
|
||||
* This is a know issue (or expected behavior maybe) to Electron.
|
||||
* We don't use this approach on Linux because it's not working.
|
||||
|
||||
@@ -67,9 +67,9 @@ export async function setupInlayWindow(params: {
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/inlay'))
|
||||
|
||||
await setupInlayWindowInvokes({ inlayWindow: window, serverChannel: params.serverChannel, i18n: params.i18n })
|
||||
|
||||
await load(window, withHashRoute(baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')), '/inlay'))
|
||||
|
||||
return window
|
||||
}
|
||||
|
||||
@@ -176,8 +176,6 @@ export async function setupMainWindow(params: {
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
await load(window, baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')))
|
||||
|
||||
await setupMainWindowElectronInvokes({
|
||||
window,
|
||||
settingsWindow: params.settingsWindow,
|
||||
@@ -193,6 +191,8 @@ export async function setupMainWindow(params: {
|
||||
windowAuthManager: params.windowAuthManager,
|
||||
})
|
||||
|
||||
await load(window, baseUrl(resolve(getElectronMainDirname(), '..', 'renderer')))
|
||||
|
||||
/**
|
||||
* This is a know issue (or expected behavior maybe) to Electron.
|
||||
* We don't use this approach on Linux because it's not working.
|
||||
|
||||
@@ -64,7 +64,6 @@ export function setupSettingsWindowReusableFunc(params: {
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(rendererBase, currentRoute))
|
||||
settingsContext = await setupSettingsWindowInvokes({
|
||||
settingsWindow: window,
|
||||
widgetsManager: params.widgetsManager,
|
||||
@@ -77,6 +76,8 @@ export function setupSettingsWindowReusableFunc(params: {
|
||||
windowAuthManager: params.windowAuthManager,
|
||||
})
|
||||
|
||||
await load(window, withHashRoute(rendererBase, currentRoute))
|
||||
|
||||
window.on('closed', () => {
|
||||
if (settingsContext)
|
||||
settingsContext = undefined
|
||||
|
||||
@@ -312,8 +312,6 @@ export function setupWidgetsWindowManager(params: {
|
||||
window.on('move', persist)
|
||||
|
||||
const initialRoute = pendingRoute ?? defaultRoute
|
||||
await loadWithRoute(window, initialRoute)
|
||||
|
||||
await setupWidgetsWindowInvokes({
|
||||
widgetWindow: window,
|
||||
widgetsManager: widgetsManager!,
|
||||
@@ -321,6 +319,8 @@ export function setupWidgetsWindowManager(params: {
|
||||
serverChannel: params.serverChannel,
|
||||
})
|
||||
|
||||
await loadWithRoute(window, initialRoute)
|
||||
|
||||
pendingRoute = undefined
|
||||
|
||||
window.on('closed', () => {
|
||||
|
||||
Reference in New Issue
Block a user