46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
const {app, Menu, BrowserWindow} = require('electron')
|
|
const path = require('path')
|
|
const url = require('url')
|
|
const themenu = require('./menu')
|
|
const setdock = require('./dock')
|
|
const ipc = require('electron').ipcMain;
|
|
|
|
require('electron-debug')();
|
|
// Keep a global reference of the window object, if you don't, the window will
|
|
// be closed automatically when the JavaScript object is garbage collected.
|
|
let win
|
|
|
|
const options = {userAgent: 'Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F27E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36'};
|
|
|
|
function createWindow () {
|
|
// Create the browser window.
|
|
win = new BrowserWindow({width: 480, height: 600,icon: path.join(__dirname, 'ic_launcher.png')})
|
|
setdock.setdock(win)
|
|
Menu.setApplicationMenu(themenu(win));
|
|
// and load the index.html of the app.
|
|
win.loadURL('http://pf.gree.net/58737',options);
|
|
// Open the DevTools.
|
|
|
|
// Emitted when the window is closed.
|
|
win.on('closed', () => {
|
|
// Dereference the window object, usually you would store windows
|
|
// in an array if your app supports multi windows, this is the time
|
|
// when you should delete the corresponding element.
|
|
win = null
|
|
})
|
|
}
|
|
|
|
// This method will be called when Electron has finished
|
|
// initialization and is ready to create browser windows.
|
|
// Some APIs can only be used after this event occurs.
|
|
app.on('ready', createWindow)
|
|
|
|
// Quit when all windows are closed.
|
|
app.on('window-all-closed', () => {
|
|
// On macOS it is common for applications and their menu bar
|
|
// to stay active until the user quits explicitly with Cmd + Q
|
|
//if (process.platform !== 'darwin') {
|
|
app.quit()
|
|
//}
|
|
})
|