本文整理匯總了TypeScript中electron.BrowserWindow.setBounds方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserWindow.setBounds方法的具體用法?TypeScript BrowserWindow.setBounds怎麽用?TypeScript BrowserWindow.setBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.setBounds方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: _setBounds
private _setBounds(): void {
if (this._state.isFullScreen) {
this._window.setFullScreen(true)
} else if (this._state.isMaximized) {
this._window.maximize()
} else {
this._window.setBounds(this._state.bounds!)
}
}
示例2: async
watcher.on(actions.openWind, async (store, action) => {
let { initialURL } = action.payload;
const rs = store.getState();
initialURL = normalizeURL(initialURL);
const secondaryWindowParams = opensInWindow(initialURL);
if (secondaryWindowParams) {
// see if we already have a window with that initialURL
for (const wind of Object.keys(rs.winds)) {
const windState = rs.winds[wind];
if (windState.properties.initialURL === initialURL) {
const nativeWin = getNativeWindow(rs, wind);
if (nativeWin) {
nativeWin.show();
nativeWin.focus();
return;
}
}
}
}
let width = 800;
let height = 600;
if (secondaryWindowParams) {
width = secondaryWindowParams.width || width;
height = secondaryWindowParams.height || height;
}
const opts: BrowserWindowConstructorOptions = {
...commonBrowserWindowOpts(store),
title: app.getName(),
width,
height,
};
const nativeWindow = new BrowserWindow(opts);
const wind = `secondary-${secondaryWindowSeed++}`;
const role: WindRole = "secondary";
store.dispatch(
actions.windOpened({
wind,
role,
nativeId: nativeWindow.id,
initialURL: initialURL,
})
);
const configKey = `${initialURL}-bounds`;
const bounds = config.get(configKey);
if (bounds) {
nativeWindow.setBounds(bounds);
}
nativeWindow.loadURL(makeAppURL({ wind, role }));
hookNativeWindow(store, wind, nativeWindow);
});