本文整理汇总了TypeScript中electron.BrowserWindow.setMaximizable方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserWindow.setMaximizable方法的具体用法?TypeScript BrowserWindow.setMaximizable怎么用?TypeScript BrowserWindow.setMaximizable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.setMaximizable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createMainWindow
function createMainWindow() {
const win = new electron.BrowserWindow({
width: 600,
height: 768,
resizable: false,
icon: path.join(__dirname, 'web_app', 'ui_components', 'icons', 'launcher.png'),
webPreferences: {
nodeIntegration: false,
preload: path.join(__dirname, 'preload.js'),
nativeWindowOpen: true
}
});
const webAppUrl = getWebAppUrl();
win.loadURL(webAppUrl);
win.webContents.on('did-get-redirect-request', (event: Event, oldUrl: string, newUrl: string) => {
console.log('[did-get-redirect-request] to %s from %s', newUrl, oldUrl);
const parts = newUrl.split('#');
if (parts.length === 2 && parts[0] === 'https://www.getoutline.org/digitalocean_oauth') {
// OAuth callback.
event.preventDefault();
win.loadURL(`${webAppUrl}#${parts[1]}`);
}
});
const loadingWindow = new LoadingWindow(win, 'outline://web_app/loading.html');
const LOADING_WINDOW_DELAY_MS = 3000;
const handleNavigation = (event: Event, url: string) => {
if (!isWhitelistedUrl(url)) {
shell.openExternal(url);
event.preventDefault();
}
};
win.webContents.on('will-navigate', (event: Event, url: string) => {
handleNavigation(event, url);
if (url.startsWith('http') && isWhitelistedUrl(url)) {
loadingWindow.showInMs(LOADING_WINDOW_DELAY_MS);
}
});
win.webContents.on('new-window', handleNavigation.bind(this));
win.webContents.on('did-finish-load', () => {
loadingWindow.hide();
});
// Disable window maximization. Setting "maximizable: false" in BrowserWindow
// options does not work as documented.
win.setMaximizable(false);
return win;
}