perf: 优化窗口加载速度

This commit is contained in:
kuaifan 2024-11-18 21:52:36 +08:00
parent 928145214d
commit 1055daa0e3
5 changed files with 1 additions and 15 deletions

View File

@ -341,18 +341,16 @@ function createChildWindow(args) {
browser = preloadWindow; browser = preloadWindow;
preloadWindow = null; preloadWindow = null;
setTimeout(() => onShowWindow(browser), 300) setTimeout(() => onShowWindow(browser), 300)
browser.once('resize', () => onShowWindow(browser)) browser.once('resize', () => setTimeout(() => onShowWindow(browser), 10))
browser.setSize(options.width, options.height); browser.setSize(options.width, options.height);
browser.setMinimumSize(options.minWidth, options.minHeight); browser.setMinimumSize(options.minWidth, options.minHeight);
browser.center(); browser.center();
browser.setParentWindow(options.parent); browser.setParentWindow(options.parent);
browser.setAutoHideMenuBar(options.autoHideMenuBar); browser.setAutoHideMenuBar(options.autoHideMenuBar);
browser.removeAllListeners("closed"); browser.removeAllListeners("closed");
console.log("use preload window")
} else { } else {
// 创建新窗口 // 创建新窗口
browser = new BrowserWindow(options) browser = new BrowserWindow(options)
console.log("create new window")
} }
browser.on('page-title-updated', (event, title) => { browser.on('page-title-updated', (event, title) => {

View File

@ -3373,9 +3373,6 @@ export default {
width: Math.min(window.screen.availWidth, 1440), width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900), height: Math.min(window.screen.availHeight, 900),
}, },
webPreferences: {
nodeIntegrationInSubFrames: msg.ext === 'drawio'
},
}); });
} else if (this.$isEEUiApp) { } else if (this.$isEEUiApp) {
this.$store.dispatch('openAppChildPage', { this.$store.dispatch('openAppChildPage', {

View File

@ -193,9 +193,6 @@ export default {
width: Math.min(window.screen.availWidth, 1440), width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900), height: Math.min(window.screen.availHeight, 900),
}, },
webPreferences: {
nodeIntegrationInSubFrames: this.file.type === 'drawio'
},
}); });
} else if (this.$isEEUiApp) { } else if (this.$isEEUiApp) {
this.$store.dispatch('openAppChildPage', { this.$store.dispatch('openAppChildPage', {

View File

@ -1706,9 +1706,6 @@ export default {
width: Math.min(window.screen.availWidth, 1440), width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900), height: Math.min(window.screen.availHeight, 900),
}, },
webPreferences: {
nodeIntegrationInSubFrames: file.ext === 'drawio'
},
}); });
} else if (this.$isEEUiApp) { } else if (this.$isEEUiApp) {
this.$store.dispatch('openAppChildPage', { this.$store.dispatch('openAppChildPage', {

View File

@ -1107,9 +1107,6 @@ export default {
width: Math.min(window.screen.availWidth, 1440), width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900), height: Math.min(window.screen.availHeight, 900),
}, },
webPreferences: {
nodeIntegrationInSubFrames: item.type === 'drawio'
},
}); });
} else if (this.$isEEUiApp) { } else if (this.$isEEUiApp) {
this.$store.dispatch('openAppChildPage', { this.$store.dispatch('openAppChildPage', {