本文整理匯總了TypeScript中electron.BrowserWindow.focus方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserWindow.focus方法的具體用法?TypeScript BrowserWindow.focus怎麽用?TypeScript BrowserWindow.focus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.focus方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: Error
mainWindow.webContents.on("did-finish-load", () => {
if (!mainWindow) {
throw new Error('"mainWindow" is not defined');
}
mainWindow.show();
mainWindow.focus();
});
示例2: onMainWindowReady
ipcMain.on('main-window-ready', function onMainWindowReady() {
// do not show windows before react is ready
if (mainWindow) {
mainWindow.show();
mainWindow.focus();
}
});
示例3: async
export const load = async (appUrl: string) => {
await app.whenReady()
const options: BrowserWindowConstructorOptions = {
width: 900,
height: 600,
autoHideMenuBar: true,
backgroundColor: '#FFFFFF',
webPreferences: {
contextIsolation: true,
preload: path.resolve(__dirname, 'renderer.js'),
webviewTag: false
},
useContentSize: true,
show: false
}
if (process.platform === 'linux') {
options.icon = path.join(__dirname, 'icon.png')
}
mainWindow = new BrowserWindow(options)
mainWindow.on('ready-to-show', () => mainWindow!.show())
mainWindow.loadURL(appUrl)
mainWindow.focus()
}
示例4:
browserWindow.webContents.on("did-finish-load", () => {
browserWindow.show();
browserWindow.focus();
});
示例5: async
export const loadFile = async (appPath: string) => {
mainWindow = await createWindow()
mainWindow.loadFile(appPath)
mainWindow.focus()
}