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


TypeScript electron.shell類代碼示例

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


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

示例1: async

  watcher.on(actions.navigate, async (store, action) => {
    let { url, resource, wind, background, replace } = action.payload;
    logger.debug(`Navigating to ${url} ${background ? "(in background)" : ""}`);

    if (opensInWindow(url)) {
      store.dispatch(
        actions.openWind({
          initialURL: url,
          role: "secondary",
        })
      );
      return;
    }

    const space = Space.fromInstance("fictional-tab", {
      history: [{ url, resource }],
      currentIndex: 0,
      sequence: 0,
    });
    if (space.protocol() == "mailto:") {
      logger.debug(`Is mailto link, opening as external and skipping tab open`);
      shell.openExternal(space.suffix);
      return;
    }

    const rs = store.getState();
    if (hasMultipleTabs(rs, wind)) {
      const nativeWindow = getNativeWindow(rs, "root");
      if (
        nativeWindow &&
        nativeWindow.isFocused() &&
        !background &&
        url !== "itch://new-tab"
      ) {
        // let it navigate the open tab
      } else {
        // open a new tab!
        const tab = uuid();
        store.dispatch(
          actions.tabOpened({
            wind,
            tab,
            url,
            resource,
            background,
          })
        );
        return;
      }
    }

    {
      const { navigation } = rs.winds[wind];
      const tab = navigation.tab;

      // navigate the single tab
      store.dispatch(
        actions.evolveTab({
          tab,
          replace,
          wind,
          url,
          resource,
        })
      );
      store.dispatch(
        actions.focusWind({
          wind,
        })
      );
    }
  });
開發者ID:itchio,項目名稱:itch,代碼行數:72,代碼來源:navigation.ts

示例2: function

 win.on('will-navigate', function(e: Event, url: string){
     e.preventDefault();
     shell.openExternal(url);
 });
開發者ID:WondermSwift,項目名稱:Shiba,代碼行數:4,代碼來源:mainu.ts

示例3:

 .then(() => {
   shell.showItemInFolder(logPath)
 })
開發者ID:Aj-ajaam,項目名稱:desktop,代碼行數:3,代碼來源:build-default-menu.ts

示例4:

						notifier.on("click", (notifierObject: NodeNotifier, options: Notification) => {
							electron.shell.openExternal(options.message + '/live');
						});
開發者ID:data9824,項目名稱:SavannaAlert,代碼行數:3,代碼來源:main.ts

示例5:

 mainWindow.webContents.on('will-navigate', (event: Event, url: string) => {
   shell.openExternal(url);
   event.preventDefault();
 });
開發者ID:fang2x,項目名稱:outline-client,代碼行數:4,代碼來源:index.ts

示例6: openLink

 export function openLink(url: string) { electron.shell.openExternal(url); }
開發者ID:MSylvia,項目名稱:superpowers-app,代碼行數:1,代碼來源:index.ts

示例7:

 editor.store.on('beep', () => shell.beep());
開發者ID:haifengkao,項目名稱:NyaoVim-Unofficial,代碼行數:1,代碼來源:nyaovim-app.ts

示例8: click

    role: 'help',
    submenu: [
      {
        label: '&About',
        click () {
          dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
            type: 'info',
            buttons: ['OK'],
            title: 'About',
            message: 'GReader is a text reader, thanks for use'
          })
        }
      },
      {
        label: '&Website',
        click () { shell.openExternal('https://github.com/guohr/GReader') }
      },
      {
        label: '&Issues',
        click () { shell.openExternal('https://github.com/guohr/GReader/issues') }
      }
    ]
  }
]

if (process.platform === 'darwin') {
  const name = app.getName()
  menuTpl.unshift({
    label: name,
    submenu: [
      {
開發者ID:makaria,項目名稱:GReader,代碼行數:31,代碼來源:menuutils.ts

示例9:

 ipcMain.on("openUrl", (event, url) => {
   shell.openExternal(url);
 });
開發者ID:Raathigesh,項目名稱:Atmo,代碼行數:3,代碼來源:messageHandler.ts

示例10: fileOpener

export function fileOpener(path: string) {

    shell.openItem(path);
}
開發者ID:atrauzzi,項目名稱:Gerty,代碼行數:4,代碼來源:FileOpener.ts


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