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


TypeScript shell.openExternal方法代碼示例

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


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

示例1: buildDefaultTemplate

  buildDefaultTemplate() {
    const templateDefault = [
      {
        label: "Help",
        submenu: [
          {
            label: "Learn More",
            click() {
              shell.openExternal("http://getatmo.com");
            }
          },
          {
            label: "Documentation",
            click() {
              shell.openExternal(
                "https://github.com/Raathigesh/atmo/blob/master/packages/app/docs/custom-script.md"
              );
            }
          },
          {
            label: "Search Issues",
            click() {
              shell.openExternal("https://github.com/Raathigesh/atmo/issues");
            }
          }
        ]
      }
    ];

    return templateDefault;
  }
開發者ID:Raathigesh,項目名稱:Atmo,代碼行數:31,代碼來源:menu.ts

示例2: buildDarwinTemplate

  buildDarwinTemplate() {
    const EditMenu = {
      label: "Edit",
      submenu: [
        { label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
        { label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
        { type: "separator" },
        { label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
        { label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
        { label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
        {
          label: "Select All",
          accelerator: "CmdOrCtrl+A",
          selector: "selectAll:"
        },
        {
          label: "Quit",
          accelerator: "Command+Q",
          click: () => {
            app.quit();
          }
        }
      ]
    };

    const subMenuHelp = {
      label: "Help",
      submenu: [
        {
          label: "Learn More",
          click() {
            shell.openExternal("http://getatmo.com");
          }
        },
        {
          label: "Documentation",
          click() {
            shell.openExternal(
              "https://github.com/Raathigesh/atmo/blob/master/packages/app/docs/custom-script.md"
            );
          }
        },
        {
          label: "Search Issues",
          click() {
            shell.openExternal("https://github.com/Raathigesh/atmo/issues");
          }
        }
      ]
    };

    return [EditMenu, subMenuHelp];
  }
開發者ID:Raathigesh,項目名稱:Atmo,代碼行數:53,代碼來源:menu.ts

示例3: if

    socket.on('shell-openExternal', (url, options, callback) => {
        let success = false;

        if (options && callback) {
            success = shell.openExternal(url, options, (error) => {
                socket.emit('shell-openExternalCallback', [url, error]);
            });
        } else if (options) {
            success = shell.openExternal(url, options);
        } else {
            success = shell.openExternal(url);
        }

        socket.emit('shell-openExternalCompleted', success);
    });
開發者ID:E024,項目名稱:Electron.NET,代碼行數:15,代碼來源:shell.ts

示例4: 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

示例5: BrowserWindow

  webContents.on('new-window', (event: any, url, _1, _2, options) => {
    event.preventDefault()

    if (/^(https:\/\/(mail|accounts)\.google\.com).*/.test(url)) {
      // Center the new window on the screen
      event.newGuest = new BrowserWindow({
        ...options,
        x: null,
        y: null
      })

      event.newGuest.webContents.on('dom-ready', () => {
        addCustomCSS(event.newGuest)
      })

      event.newGuest.webContents.on(
        'new-window',
        (event: Event, url: string) => {
          event.preventDefault()
          shell.openExternal(url)
        }
      )
    } else {
      shell.openExternal(url)
    }
  })
開發者ID:,項目名稱:,代碼行數:26,代碼來源:

示例6: downloadVideo

	export function downloadVideo(url: string, removeOverlay: boolean = false) {
		if (removeOverlay) {
			const searchPageView = $('#downloadVideoView');
			searchPageView && searchPageView.remove();
		}
		shell.openExternal(`https://ytmp3.cc/#v${url.split('?v=')[1]}`);
	}
開發者ID:SanderRonde,項目名稱:youtube-music-app,代碼行數:7,代碼來源:util.ts

示例7: reportIssue

export function reportIssue(opts: ReportIssueOpts) {
  if (typeof opts === "undefined") {
    opts = {};
  }

  const log = opts.log;
  let body = opts.body || "";
  let type = opts.type || "Issue";
  const repo = opts.repo || urls.itchRepo;
  const before = opts.before || "";

  if (typeof log !== "undefined") {
    type = "Feedback";
    body = `Event log:

\`\`\`
${log}
\`\`\`
`;
  }

  const platformEmoji = platformData[currentRuntime().platform].emoji;
  const query = querystring.stringify({
    title: `${platformEmoji} ${type} v${app.getVersion()}`,
    body: before + body,
  });
  let url = `${repo}/issues/new?${query}`;
  const maxLen = 2000;
  if (url.length > maxLen) {
    url = url.substring(0, maxLen);
  }
  shell.openExternal(url);
}
開發者ID:itchio,項目名稱:itch,代碼行數:33,代碼來源:crash-reporter.ts

示例8: onClickContents

 private onClickContents(event: MouseEvent) {
   event.preventDefault();
   if (event.target instanceof HTMLAnchorElement) {
     const target = event.target as HTMLAnchorElement;
     shell.openExternal(target.href);
   }
 }
開發者ID:richardy2012,項目名稱:cafe-pitch,代碼行數:7,代碼來源:markdown.directive.ts

示例9: navigate

export function navigate(url: string) {
    try {
        const parsed = URL.parse(url);
        if (parsed.protocol === "emulator:") {
            const params = QueryString.parse(parsed.query);
            if (parsed.host === 'inspect') {
                navigateInspectUrl(params);
            } else if (parsed.host === 'appsettings') {
                navigateAppSettingsUrl(params);
            } else if (parsed.host === 'botcreds') {
                navigateBotCredsUrl(params);
            } else if (parsed.host === 'command') {
                navigateCommandUrl(params);
            }
        } else if (parsed.protocol.startsWith(PaymentEncoder.PaymentEmulatorUrlProtocol)) {
            navigatePaymentUrl(parsed.path);
        } else if (parsed.protocol.startsWith(OAuthClientEncoder.OAuthEmulatorUrlProtocol)) {
            navigateEmulatedOAuthUrl(url.substring(8));
        } else if (parsed.protocol.startsWith(OAuthLinkEncoder.OAuthUrlProtocol)) {
            navigateOAuthUrl(url.substring(12));
        } else if (parsed.protocol.startsWith('file:')) {
            // ignore
        } else if (parsed.protocol.startsWith('javascript:')) {
            // ignore
        } else {
            shell.openExternal(url, { activate: true });
        }
    } catch (e) {
        log.error(e.message);
    }
}
開發者ID:kpreeti096,項目名稱:BotFramework-Emulator,代碼行數:31,代碼來源:hyperlinkHandler.ts

示例10: deferURL

export function deferURL(event: Event, url: string) {
  event.preventDefault();
  if (!url.startsWith("file:")) {
    shell.openExternal(url);
  } else if (url.endsWith(".ipynb")) {
    launchIpynb(url);
  }
}
開發者ID:nteract,項目名稱:nteract,代碼行數:8,代碼來源:launch.ts


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