本文整理匯總了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;
}