本文整理汇总了TypeScript中electron.BrowserWindow.hide方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserWindow.hide方法的具体用法?TypeScript BrowserWindow.hide怎么用?TypeScript BrowserWindow.hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.hide方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
webContents.on('dom-ready', async () => {
await updateAppMenu();
webContents.insertCSS(readFileSync(path.join(__dirname, '..', 'css', 'browser.css'), 'utf8'));
webContents.insertCSS(readFileSync(path.join(__dirname, '..', 'css', 'dark-mode.css'), 'utf8'));
webContents.insertCSS(readFileSync(path.join(__dirname, '..', 'css', 'vibrancy.css'), 'utf8'));
webContents.insertCSS(
readFileSync(path.join(__dirname, '..', 'css', 'code-blocks.css'), 'utf8')
);
if (config.get('useWorkChat')) {
webContents.insertCSS(
readFileSync(path.join(__dirname, '..', 'css', 'workchat.css'), 'utf8')
);
}
if (existsSync(path.join(app.getPath('userData'), 'custom.css'))) {
webContents.insertCSS(readFileSync(path.join(app.getPath('userData'), 'custom.css'), 'utf8'));
}
if (config.get('launchMinimized') || app.getLoginItemSettings().wasOpenedAsHidden) {
mainWindow.hide();
} else {
mainWindow.show();
}
webContents.send('toggle-mute-notifications', config.get('notificationsMuted'));
webContents.send('toggle-message-buttons', config.get('showMessageButtons'));
webContents.executeJavaScript(
readFileSync(path.join(__dirname, 'notifications-isolated.js'), 'utf8')
);
});
示例2:
mainWindow.on('close', e => {
if (!isQuitting) {
e.preventDefault()
mainWindow.blur()
mainWindow.hide()
}
})
示例3:
const toggleWin = (): void => {
if (win.isVisible()) {
win.hide();
} else {
win.show();
}
};
示例4:
win.on("close", event => {
if (process.platform === "win32" && !isRestarting) {
event.preventDefault();
if (win != null) {
win.hide();
}
}
});
示例5: t
nativeWindow.on("close", (e: any) => {
const rs = store.getState();
if (wind === "root") {
const prefs =
rs.preferences || ({ closeToTray: true } as PreferencesState);
let { closeToTray } = prefs;
if (rs.system.macos) {
closeToTray = true;
}
if (env.integrationTests) {
// always let app close in testing
closeToTray = false;
}
if (store.getState().system.quitting) {
logger.debug("On window.close: quitting, letting it close");
return;
}
if (closeToTray) {
logger.debug("On window.close: close to tray enabled");
} else {
logger.debug("On window.close: close to tray disabled, quitting!");
process.nextTick(() => {
store.dispatch(actions.quit({}));
});
return;
}
// hide, never destroy
e.preventDefault();
nativeWindow.hide();
if (!prefs.gotMinimizeNotification && !store.getState().system.macos) {
store.dispatch(
actions.updatePreferences({
gotMinimizeNotification: true,
})
);
const i18n = store.getState().i18n;
store.dispatch(
actions.notify({
title: t(i18n, ["notification.see_you_soon.title"]),
body: t(i18n, ["notification.see_you_soon.message"]),
})
);
}
} else {
store.dispatch(actions.windClosed({ wind }));
}
});
示例6: switch
electron.ipcMain.on('loadWindow', (event, arg) => {
switch (arg) {
case 1:
mainWindow.hide();
registerWindow.show();
break;
case 2:
registerWindow.hide();
mainWindow.show();
break;
case 3:
mainWindow.loadURL('file://' + __dirname + '/views/chat.html');
break;
case 4:
mainWindow.loadURL('file://' + __dirname + '/views/room.html');
break;
default:
registerWindow.hide();
mainWindow.show();
}
socket.removeAllListeners("receive");
});
示例7:
main.on('close', event => {
if (!isQuitting) {
event.preventDefault();
logger.log('Closing window...');
if (main.isFullScreen()) {
logger.log('Fullscreen detected, leaving full screen before hiding...');
main.once('leave-full-screen', () => main.hide());
main.setFullScreen(false);
} else {
main.hide();
}
}
systemMenu.unregisterShortcuts();
});
示例8: function
click: function() {
mainWindow.hide();
}