当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript BrowserWindow.getFocusedWindow方法代码示例

本文整理汇总了TypeScript中electron.BrowserWindow.getFocusedWindow方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserWindow.getFocusedWindow方法的具体用法?TypeScript BrowserWindow.getFocusedWindow怎么用?TypeScript BrowserWindow.getFocusedWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron.BrowserWindow的用法示例。


在下文中一共展示了BrowserWindow.getFocusedWindow方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: toggleMaximizeWindow

async function toggleMaximizeWindow() {
  const window = BrowserWindow.getFocusedWindow();
  if (window) {
    if (window.isMaximized()) {
      window.unmaximize();
    } else {
      window.maximize();
    }
  }
}
开发者ID:HorrerGames,项目名称:itch,代码行数:10,代码来源:main-window.ts

示例2: async

 watcher.on(actions.openDevTools, async (store, action) => {
   const { wind, tab } = action.payload;
   if (tab) {
     const { tab } = store.getState().winds[wind].navigation;
     withWebContents(store, wind, tab, wc => {
       wc.openDevTools({ mode: "detach" });
     });
   } else {
     openAppDevTools(BrowserWindow.getFocusedWindow());
   }
 });
开发者ID:itchio,项目名称:itch,代码行数:11,代码来源:web-contents.ts

示例3: async

 watcher.on(actions.openDevTools, async (store, action) => {
   const { window, forApp } = action.payload;
   if (forApp) {
     await openAppDevTools(BrowserWindow.getFocusedWindow());
   } else {
     const { tab } = store.getState().windows[window].navigation;
     withWebContents(store, window, tab, wc => {
       wc.openDevTools({ mode: "bottom" });
     });
   }
 });
开发者ID:HorrerGames,项目名称:itch,代码行数:11,代码来源:web-contents.ts

示例4: async

  watcher.on(actions.quitWhenMain, async (store, action) => {
    const mainId = getNativeState(store.getState(), "root").id;
    const focused = BrowserWindow.getFocusedWindow();

    if (focused) {
      if (focused.id === mainId) {
        store.dispatch(actions.quit({}));
      } else {
        focused.close();
      }
    }
  });
开发者ID:HorrerGames,项目名称:itch,代码行数:12,代码来源:main-window.ts

示例5: async

        this.router.get('/devTools', async (ctx, next) => {
            const win = BrowserWindow.getFocusedWindow();
            if (win) {
                win.webContents.openDevTools({
                    mode: 'detach'
                });

                setTimeout(() => win.focus(), 2000);
            }

            ctx.body = {
                message: 'success'
            };
        });
开发者ID:BabylonJS,项目名称:Editor,代码行数:14,代码来源:tools.ts

示例6: getHelpItems

/**
 * Returns additional items for the help menu
 *
 * @returns {Array<Electron.MenuItemConstructorOptions>}
 */
function getHelpItems(): Array<MenuItemConstructorOptions> {
  return [
    {
      type: 'separator'
    },
    {
      label: 'Show Welcome Tour',
      click() {
        ipcMainManager.send(IpcEvents.SHOW_WELCOME_TOUR);
      }
    },
    {
      type: 'separator'
    },
    {
      label: 'Toggle Developer Tools',
      accelerator: 'CmdOrCtrl+Option+i',
      click() {
        const browserWindow = BrowserWindow.getFocusedWindow();

        if (browserWindow && !browserWindow.isDestroyed()) {
          browserWindow.webContents.openDevTools({ mode: 'bottom' });
        }
      }
    },
    {
      type: 'separator'
    },
    {
      label: 'Open Fiddle Repository...',
      click() {
        shell.openExternal('https://github.com/electron/fiddle');
      }
    },
    {
      label: 'Open Electron Repository...',
      click() {
        shell.openExternal('https://github.com/electron/electron');
      }
    },
    {
      label: 'Open Electron Issue Tracker...',
      click() {
        shell.openExternal('https://github.com/electron/electron/issues');
      }
    },
  ];
}
开发者ID:bpasero,项目名称:fiddle,代码行数:53,代码来源:menu.ts

示例7: showAboutBox

function showAboutBox() {
    var packageJSON = require("../../package.json");
    var version = packageJSON.version;

    var stats = fs.statSync(process.execPath);
    var mtime = new Date(stats.mtime);
    var buildDate = mtime.toString();

    dialog.showMessageBox(BrowserWindow.getFocusedWindow()!, {
        type: "info",
        title: "EEZ Studio",
        message: "EEZ Studio",
        detail: `Version: ${version}\nBuild date: ${buildDate}`,
        buttons: []
    });
}
开发者ID:eez-open,项目名称:studio,代码行数:16,代码来源:about-box.ts

示例8: download

ipcMain.on('download-file-message', (event, args) => {
  console.log(args)  // prints "ping"
  event.sender.send('download-file-reply', 'pong');

  var folderPaths = dialog.showOpenDialog({ properties: ['openDirectory'] });
  console.log(folderPaths);

  if (folderPaths.length > 0) {
    download(BrowserWindow.getFocusedWindow(), args.url, {
      directory: folderPaths[0],
      filename: args.fileName
    })
      .then(dl => console.log(dl.getSavePath()))
      .catch(console.error);
  }
})
开发者ID:mangabot,项目名称:mangabot,代码行数:16,代码来源:main.ts

示例9: getFocusedWebContents

function getFocusedWebContents(): WebContents {
  const focusedWindow = BrowserWindow.getFocusedWindow()
  return focusedWindow == null ? null : focusedWindow.webContents
}
开发者ID:agozie,项目名称:onshape-desktop-shell,代码行数:4,代码来源:AppMenuManager.ts

示例10: it

 it('should return a positive number for critical type', () => {
   const appHasFocus = !!BrowserWindow.getFocusedWindow()
   if (!appHasFocus) {
     expect(app.dock.bounce('critical')).to.be.at.least(0)
   }
 })
开发者ID:malept,项目名称:electron,代码行数:6,代码来源:api-app-spec.ts


注:本文中的electron.BrowserWindow.getFocusedWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。