// -----  Serial Port が使えるか確認 --------
try {
  require('serialport');
} catch (error) {
  console.log(error);
  process.exit(1);
}

const { app, BrowserWindow } = require('electron');
const path = require("path");

const MAIN_HTML = "main.html";

function createWindow() {
  const mainWindow = new BrowserWindow({
    width: 200,
    height: 200
  });
  mainWindow.loadFile(path.resolve(__dirname, MAIN_HTML));
}

app.whenReady().then(() => {
  createWindow()
  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) createWindow();
  })
});

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit();
});
