How to use nextron - 4 common examples

To help you get started, we’ve selected a few nextron 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 saltyshiomix / nextron / examples / with-javascript / main / index.js View on Github external
async function createMainWindow() {
  isDev && await prepareNext('./renderer')

  const window = new BrowserWindow()
  isDev && window.webContents.openDevTools()

  const url = isDev ? 'http://localhost:8000/home' : format({
    pathname: path.join(__dirname, '../renderer/home/index.html'),
    protocol: 'file',
    slashes: true
  })

  window.loadURL(url)

  window.on('closed', () => {
    mainWindow = null
  })
github saltyshiomix / nextron / examples / with-typescript / main / index.ts View on Github external
async function createMainWindow(): Promise {
  isDev && await prepareNext('./renderer')

  const window: BrowserWindow = new BrowserWindow()
  isDev && window.webContents.openDevTools()

  const url: string = isDev ? 'http://localhost:8000/home' : format({
    pathname: path.join(__dirname, '../renderer/home/index.html'),
    protocol: 'file',
    slashes: true
  })

  window.loadURL(url)

  window.on('closed', () => {
    mainWindow = null
  })
github saltyshiomix / nextron / build / common / perform-start.js View on Github external
module.exports = async function performStart(config) {
  const compiler = webpack(config('development'))
  let electronStarted = false

  await buildRenderer('renderer')

  const watching = compiler.watch({}, function(err, stats) {
    if (!err && !stats.hasErrors() && !electronStarted) {
      electronStarted = true

      childProcess
        .spawn(electron, ['./app/background.js'], { stdio: 'inherit' })
        .on('close', () => {
          watching.close()
        })
    }
  })
}
github saltyshiomix / nextron / examples / with-javascript / background.js View on Github external
app.on('ready', () => {
  const mainWindow = createWindow('main', {
    width: 1000,
    height: 600
  });

  mainWindow.loadURL(
    format({
      pathname: join(__dirname, 'home/index.html'),
      protocol: 'file:',
      slashes: true
    })
  );

  if (env.name === 'development') {
    mainWindow.openDevTools();
  }
});

nextron

⚡ NEXT.js + Electron ⚡

MIT
Latest version published 1 month ago

Package Health Score

84 / 100
Full package analysis