本文整理汇总了TypeScript中electron.BrowserWindow.fromId方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserWindow.fromId方法的具体用法?TypeScript BrowserWindow.fromId怎么用?TypeScript BrowserWindow.fromId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.fromId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getNativeWindow
export function getNativeWindow(rs: IRootState, window: string): BrowserWindow {
const ns = getNativeState(rs, window);
if (ns) {
return BrowserWindow.fromId(ns.id);
}
return null;
}
示例2: updateTitle
function updateTitle(store: IStore, title: string) {
const id = store.getState().windows["root"].native.id;
if (!id) {
return;
}
const window = BrowserWindow.fromId(id);
if (!window) {
return;
}
window.setTitle(title);
}
示例3:
socket.on('showMessageBox', (browserWindow, options, guid) => {
if ("id" in browserWindow) {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showMessageBox(window, options, (response, checkboxChecked) => {
socket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
});
} else {
var message = browserWindow;
let id = guid || options;
dialog.showMessageBox(browserWindow, (response, checkboxChecked) => {
socket.emit('showMessageBoxComplete' + id, [response, checkboxChecked]);
});
}
});
示例4: async
watcher.on(actions.openWindow, async (store, action) => {
const { initialURL, modal } = action.payload;
const rs = store.getState();
if (opensInWindow[initialURL]) {
// see if we already have a window with that initialURL
for (const window of Object.keys(rs.windows)) {
const windowState = rs.windows[window];
if (windowState.navigation.initialURL === initialURL) {
const nativeWin = getNativeWindow(rs, window);
if (nativeWin) {
nativeWin.focus();
}
return;
}
}
}
const mainId = rs.windows["root"].native.id;
const nativeWindow = new BrowserWindow({
...commonBrowserWindowOpts(),
title: app.getName(),
parent: modal ? BrowserWindow.fromId(mainId) : null,
modal,
});
const window = `secondary-${secondaryWindowSeed++}`;
const role: ItchWindowRole = "secondary";
store.dispatch(
actions.windowOpened({
window,
role,
nativeId: nativeWindow.id,
initialURL: initialURL,
})
);
nativeWindow.loadURL(makeAppURL({ window, role }));
hookNativeWindow(store, window, nativeWindow);
});
示例5:
contextMenuItems.forEach(x => {
if(x.browserWindowId === browserWindowId) {
let browserWindow = BrowserWindow.fromId(browserWindowId);
x.menu.popup(browserWindow);
}
});
示例6: getWindowById
function getWindowById(id: number): Electron.BrowserWindow {
return BrowserWindow.fromId(id);
}
示例7:
const getPrimaryWindow = () => {
const [primaryWindow] = primaryWindowId ? [BrowserWindow.fromId(primaryWindowId)] : BrowserWindow.getAllWindows();
return primaryWindow;
};
示例8: getWindowById
socket.on('browserWindowSetParentWindow', (id, parent) => {
const browserWindow = BrowserWindow.fromId(parent.id);
getWindowById(id).setParentWindow(browserWindow);
});