本文整理汇总了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);
});