How to use the electron.BrowserWindow function in electron

To help you get started, we’ve selected a few electron 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 xtuJSer / CoCoMusic / src / main / index.js View on Github external
function createWindow () {
  /**
   * Initial window options
   */
  var isSide = localStorage.getItem('winSideSetting') === 'true'
  mainWindow = new BrowserWindow({
    minHeight: 720, // 尤其是 有着1T 显存的 gt630 战术核显卡,只要一发就能摧毁一个航母战斗群。
    height: 720,
    useContentSize: true,
    minWidth: 1195,
    width: 1195,
    autoHideMenuBar: false,
    show: false,
    resizable: true,
    icon: '../../build/icons/256x256.png',
    darkTheme: true,
    frame: isSide
  })
  mainWindow.loadURL(winURL)

  mainWindow.on('close', (e) => {
    if (localStorage.getItem('hideSetting') === 'true') {
github supnate / command-pad / app / node / main.js View on Github external
function createWindow () {
  // Create the browser window.
  if (isDev) {
    win = new BrowserWindow({width: 860, height: 600 });
  } else {
    win = new BrowserWindow({width: 360, height: 600 });
  }

  // and load the index.html of the app.
  if (isDev) {
    win.loadURL('http://localhost:6076/');
  } else {
    win.loadURL(`file://${__dirname}/../index.html`);
  }

  // Open the DevTools.
  if (isDev) win.webContents.openDevTools()

  // Emitted when the window is closed.
  win.on('closed', () => {
github yafp / ttth / main.js View on Github external
if (currentBadgeCount !== arg) {
                var didUpdateBadgeCount = app.setBadgeCount(arg) // FIXME: deprecated.- Please use 'badgeCount property' instead.
                if (didUpdateBadgeCount === true) {
                    writeLog('info', 'createWindow ::: Updating application badge count to _' + arg + '_.') // updating badge count worked
                } else {
                    writeLog('warn', 'createWindow ::: Updating application badge count to _' + arg + '_ failed.') // updating badge count failed
                }
            }
        }
    })

    // *****************************************************************
    // modal window: to allow creating and configuring a single service
    // *****************************************************************
    //
    configWindow = new BrowserWindow({
        parent: mainWindow,
        modal: true, // Whether this is a modal window. This only works when the window is a child window
        title: '${productName}',
        frame: false, // false results in a borderless window
        show: false, // hide as default
        titleBarStyle: 'hidden',
        resizable: false,
        width: 600,
        height: 650,
        minWidth: 600,
        minHeight: 650,
        backgroundColor: '#ffffff',
        icon: path.join(__dirname, 'app/img/icon/icon.png'),
        webPreferences: {
            nodeIntegration: true,
            webviewTag: true // see #37
github KevinGrandon / ghostjs / ghostjs-core / src / protocol / electron.js View on Github external
async createWindow (url, options) {
    this.url = url;

    // TODO: We can spawn an electron window here, or ideally communicate with an already opened window.

    this.currentWin = new BrowserWindow();
    this.currentWin.webContents.on('did-fail-load', this.handleFailure);
    this.currentWin.webContents.on('did-fail-provisional-load', this.handleFailure);
    this.currentWin.webContents.on('did-get-response-details', this.handleDetails);
    this.currentWin.webContents.on('dom-ready', this.handleDomReady);
    this.currentWin.webContents.on('did-finish-load', this.handleFinish);
    this.currentWin.webContents.loadURL(url, loadUrlOptions);
  }
github electron / fiddle / static / show-me / crashreporter / main.js View on Github external
app.on('ready', () => {
  mainWindow = new BrowserWindow({
    height: 600,
    width: 600,
    webPreferences: {
      nodeIntegration: true
    }
  })
  mainWindow.loadFile('index.html')

  mainWindow.webContents.on('crashed', () => {
    console.log('Window crashed!')
  })
})
github trazyn / ieaseMusic / submodules / downloader / index.js View on Github external
function createDownloader() {
    if (downloader) {
        showDownloader();
    }

    var mainWindowState = windowStateKeeper({
        defaultWidth: 360,
        defaultHeight: 520,
    });

    downloader = new BrowserWindow({
        x: mainWindowState.x + 800,
        y: mainWindowState.y,
        show: false,
        width: 360,
        height: 520,
        resizable: false,
        maximizable: false,
        fullscreenable: false,
        backgroundColor: 'none',
        titleBarStyle: 'hiddenInset',
    });

    downloader.on('close',
        event => {
            event.preventDefault();
            downloader.hide();
github pymedphys / pymedphys / src / pymedphys / gui / src / main / index.ts View on Github external
function createMainWindow() {
  const window = new BrowserWindow()

  if (isDevelopment) {
    window.webContents.openDevTools()

    const reactDevTools = [
      '/home/simon/.config/google-chrome/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/3.4.3_0'
    ]

    reactDevTools.forEach(path => {
      if (fs.existsSync(path)) {
        BrowserWindow.addDevToolsExtension(path)
      }
    });
    window.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`)
  }
  else {
github electron / i18n / content / en-US / docs / fiddles / communication / two-processes / asynchronous-messages / main.js View on Github external
function createWindow() {
  const windowOptions = {
    width: 600,
    height: 400,
    title: 'Asynchronous messages',
    webPreferences: {
      nodeIntegration: true,
    },
  }

  mainWindow = new BrowserWindow(windowOptions)
  mainWindow.loadFile('index.html')

  mainWindow.on('closed', () => {
    mainWindow = null
  })
}
github chrispsn / mesh / src / electron_setup.js View on Github external
function createMainWindow() {
	const win = new electron.BrowserWindow({
		width: 1200,
		height: 800,
        webPreferences: {
            webSecurity: false
        },
        autoHideMenuBar: true
	});

	win.loadURL(`file://${__dirname}/main.html`);
	win.on('closed', onClosed);

	return win;
}
github witnet / sheikah / app / main / index.js View on Github external
.then(() => {
  mainWindow = new BrowserWindow({
    show: false,
    width: 1024,
    height: 728
  });

    mainWindow.loadURL(appHtml);

  mainWindow.webContents.on('did-finish-load', () => {
    mainWindow.show();
    mainWindow.focus();
  });

  mainWindow.on('closed', () => {
    mainWindow = null;
  });