How to use the open function in open

To help you get started, we’ve selected a few open examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github colinking / n1-unsubscribe / lib / thread-unsubscribe-store.es6 View on Github external
_unsubscribeViaBrowser(url, callback) {
    if ((!this.isForwarded && !this.settings.confirmForBrowser) ||
      userConfirm(this.confirmText, `A browser will be opened at: ${shortenURL(url)}`)) {
      logIfDebug(`Opening a browser window to:\n${url}`);
      if (this.settings.defaultBrowser === "native" || electronCantOpen(url)) {
        open(url);
        callback(null, /* unsubscribed=*/true);
      } else {
        const browserWindow = new remote.BrowserWindow({
          'web-preferences': { 'web-security': false, 'nodeIntegration': false },
          'width': 1000,
          'height': 800,
          'center': true,
          "alwaysOnTop": true,
        });
        browserWindow.on('closed', () => {
          callback(null, /* unsubscribed=*/true);
        });
        browserWindow.webContents.on('did-fail-load', (event, errorCode, errorDescription) => {
          // Unable to load this URL in a browser window. Redirect to a native browser.
          logIfDebug(`Failed to open URL in browser window: ${errorCode} ${errorDescription}`);
          browserWindow.destroy();
github nodkz / relay-northwind-app / tools / startDevServers.js View on Github external
const http = devCommonProxy.listen(PORT, () => {
      resolve();
      const serverUrl = `http://127.0.0.1:${PORT}`;
      console.log(chalk.bgGreen.bold(`Development server started at ${serverUrl}`));
      open(serverUrl);
    });
    http.on('error', reject);
github ritwickdey / vscode-live-server-plus-plus / src / extension / services / BrowserService.ts View on Github external
private openInBrowser(event: GoLiveEvent) {
    const host = '127.0.0.1';
    const port = event.LSPP.port;
    const pathname = this.getPathname();
    const protocol = 'http:';
    const browserName = extensionConfig.browser.get();
    if (!browserName) return;

    const openParams: string[] = [];

    if (browserName !== 'default') {
      openParams.push(getNormalizedBrowserName(browserName));
    }

    open(`${protocol}//${host}:${port}${pathname}`, { app: openParams });
  }
github shuidi-fed / vuese / packages / cli / lib / server.ts View on Github external
server.listen(port, config.host, () => {
    const addr = `http://${config.host}:${port}/`
    logger.success(`Server running at ${addr}`)
    if (config.open) open(addr)
  })
}
github unfoldingWord / translationCore / src / js / components / home / usersManagement / Login.js View on Github external
this.props.actions.confirmOnlineAction(() => {
      open('https://git.door43.org/user/sign_up');
    });
  }

open

Open stuff like URLs, files, executables. Cross-platform.

MIT
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis