Logo Pastebin.fr
Pastebin

Retrouvez, créez et partagez vos snippets en temps réel.

blabla

'use strict'

import { app, protocol, BrowserWindow, globalShortcut } from 'electron'
import {
    createProtocol,
    installVueDevtools
} from 'vue-cli-plugin-electron-builder/lib'
const isDevelopment = false
const ipc = require('electron').ipcMain

let win

protocol.registerStandardSchemes(['app'], { secure: true })

function createWindow() {
    var iconPath = 'app://./logo.png'
    if (process.env.WEBPACK_DEV_SERVER_URL) {
        iconPath = process.env.WEBPACK_DEV_SERVER_URL + 'logo.png'
    }
    console.log('iconPath')
    console.log(iconPath)
    win = new BrowserWindow({ width: 800, height: 600, icon: iconPath })
    win.setMenu(null)
    win.maximize()
    win.setFullScreen(true)

    if (process.env.WEBPACK_DEV_SERVER_URL) {
        win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
            // if (!process.env.IS_TEST) win.webContents.openDevTools()
    } else {
        createProtocol('app')
        win.loadURL('app://./index.html')
    }

    // win.webContents.openDevTools()

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

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

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

app.on('ready', async() => {

    createWindow()

    // globalShortcut.register('CommandOrControl+Shift+I', () => {
    //     if (win) {
    //         win.webContents.toggleDevTools()
    //     }
    // })
})



ipc.on('closeApp', function(event, arg) {
    app.quit()
})

app.on('will-quit', () => {
    globalShortcut.unregisterAll()
})

Créé il y a 1 semaine.

Rechercher un Pastebin

Aucun paste trouvé.