How to use open - 10 common examples

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');
    });
  }
github carbon-design-system / carbon / src / components / ListBox / ListBoxMenuIcon.js View on Github external
import cx from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
import ChevronDown16 from '@carbon/icons-react/lib/chevron--down/16';
import { settings } from 'carbon-components';

const { prefix } = settings;

export const translationIds = {
  'close.menu': 'close.menu',
  'open.menu': 'open.menu',
};

const defaultTranslations = {
  [translationIds['close.menu']]: 'Close menu',
  [translationIds['open.menu']]: 'Open menu',
};

/**
 * `ListBoxMenuIcon` is used to orient the icon up or down depending on the
 * state of the menu for a given `ListBox`
 */
const ListBoxMenuIcon = ({ isOpen, translateWithId: t }) => {
  const className = cx({
    [`${prefix}--list-box__menu-icon`]: true,
    [`${prefix}--list-box__menu-icon--open`]: isOpen,
  });
  const description = isOpen ? t('close.menu') : t('open.menu');
  return (
    <div role="button">
      
        <title>{description}</title></div>

open

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

MIT
Latest version published 9 months ago

Package Health Score

82 / 100
Full package analysis