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

app.commandLine.appendSwitch('ppapi-flash-path', path.join(__dirname, 'pepflashplayer.dll'))

let win

function createWindow () {

    win = new BrowserWindow({

        width: 1280,
        height: 960,
        webPreferences: {
            nodeIntegration:true,
            webviewTag: true,
            plugins: true,
            nativeWindowOpen: true,
            allowRunningInsecureContent: true
        },
        icon: path.join(__dirname, 'assets/icons/png/128.png')
    })

    win.setMenuBarVisibility(false)


    win.loadFile('index.html')

    //win.webContents.openDevTools()

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

}

app.on('ready', createWindow)

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

app.on('activate', () => {
    if (win === null) {
        createWindow()
    }
})