當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript electron.BrowserWindow類代碼示例

本文整理匯總了TypeScript中electron.BrowserWindow的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserWindow類的具體用法?TypeScript BrowserWindow怎麽用?TypeScript BrowserWindow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了BrowserWindow類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 (response: number) => {
   if (!response) {
     BrowserWindow.getAllWindows().forEach(w => w.webContents.reloadIgnoringCache());
   }
 }
開發者ID:chauey,項目名稱:ngrev,代碼行數:5,代碼來源:application_menu_template.ts

示例2: minimizeWindow

async function minimizeWindow() {
  const window = BrowserWindow.getFocusedWindow();
  if (window) {
    window.minimize();
  }
}
開發者ID:HorrerGames,項目名稱:itch,代碼行數:6,代碼來源:main-window.ts

示例3: createRootWindow

async function createRootWindow(store: IStore) {
  const window = "root";
  const role: ItchWindowRole = "main";
  const userBounds = config.get(BOUNDS_CONFIG_KEY) || {};
  const bounds = {
    x: -1,
    y: -1,
    width: 1250,
    height: 720,
    ...userBounds,
  };
  const { width, height } = bounds;
  const center = bounds.x === -1 && bounds.y === -1;

  let opts: Electron.BrowserWindowConstructorOptions = {
    ...commonBrowserWindowOpts(),
    title: app.getName(),
    width,
    height,
    center,
    show: false,
  };
  const nativeWindow = new BrowserWindow(opts);
  store.dispatch(
    actions.windowOpened({
      window,
      role,
      nativeId: nativeWindow.id,
      initialURL: "itch://library",
    })
  );

  if (os.platform() === "darwin") {
    try {
      app.dock.setIcon(getIconPath());
    } catch (err) {
      logger.warn(`Could not set dock icon: ${err.stack}`);
    }
  }

  if (!center) {
    nativeWindow.setPosition(bounds.x, bounds.y);
  }
  ensureWindowInsideDisplay(nativeWindow);

  nativeWindow.on("close", (e: any) => {
    const prefs = store.getState().preferences || { closeToTray: true };

    let { closeToTray } = prefs;
    if (env.integrationTests) {
      // always let app close in testing
      closeToTray = false;
    }

    if (closeToTray) {
      logger.debug("Close to tray enabled");
    } else {
      logger.debug("Close to tray disabled, quitting!");
      process.nextTick(() => {
        store.dispatch(actions.quit({}));
      });
      return;
    }

    if (!nativeWindow.isVisible()) {
      logger.info("Main window hidden, letting it close");
      return;
    }

    if (!prefs.gotMinimizeNotification) {
      store.dispatch(
        actions.updatePreferences({
          gotMinimizeNotification: true,
        })
      );

      const i18n = store.getState().i18n;
      store.dispatch(
        actions.notify({
          title: t(i18n, ["notification.see_you_soon.title"]),
          body: t(i18n, ["notification.see_you_soon.message"]),
        })
      );
    }

    // hide, never destroy
    e.preventDefault();
    logger.info("Hiding main window");
    nativeWindow.hide();
  });

  hookNativeWindow(store, window, nativeWindow);

  nativeWindow.on("maximize", (e: any) => {
    config.set(MAXIMIZED_CONFIG_KEY, true);
  });

  nativeWindow.on("unmaximize", (e: any) => {
    config.set(MAXIMIZED_CONFIG_KEY, false);
  });
//.........這裏部分代碼省略.........
開發者ID:HorrerGames,項目名稱:itch,代碼行數:101,代碼來源:main-window.ts

示例4: initializeMainWindow

function initializeMainWindow(){
  applicationRef = new electron.BrowserWindow();
  applicationRef.loadURL(`file://${process.cwd()}/demo/index.html`);
}
開發者ID:earthquaker,項目名稱:angular-electron,代碼行數:4,代碼來源:electron_app.ts

示例5:

 socket.on('showSaveDialog', (browserWindow, options, guid) => {
     var window = BrowserWindow.fromId(browserWindow.id);
     dialog.showSaveDialog(window, options, (filename) => {
         socket.emit('showSaveDialogComplete' + guid, filename || '');
     });
 });
開發者ID:E024,項目名稱:Electron.NET,代碼行數:6,代碼來源:dialog.ts

示例6: require

            } else {
                // service window not found, just return serviceImplementation
                // so calling process will execute service implementation function
                return serviceImplementation;
            }
        };
    }
} else {
    // this is main proccess
    const { BrowserWindow, ipcMain } = require("electron");

    // create service process
    var windowContructorParams: Electron.BrowserWindowConstructorOptions = {
        show: false
    };
    let browserWindow = new BrowserWindow(windowContructorParams);
    browserWindow.loadURL(`file://${__dirname}/../eez-studio-shared/service.html`);

    // waiting for the new task
    ipcMain.on(NEW_TASK_CHANNEL, (event: Electron.Event, task: ITask) => {
        function send(taskResult: ITaskResult) {
            // send result back to calling process
            event.sender.send(TASK_DONE_CHANNEL + task.taskId, taskResult);
        }

        function sendResult(result: any) {
            send({ result });
        }

        function sendError(error: any) {
            send({ error });
開發者ID:eez-open,項目名稱:studio,代碼行數:31,代碼來源:service.ts

示例7:

 mainWindow.on('ready', () => {
     mainWindow.show();
 });
開發者ID:TheColorRed,項目名稱:photo-editor,代碼行數:3,代碼來源:main.ts

示例8:

					click: () => {
						mainWindow.show();
						sendAction('jump-to-conversation', index + 1);
					}
開發者ID:kusamakura,項目名稱:caprine,代碼行數:4,代碼來源:index.ts


注:本文中的electron.BrowserWindow類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。