electron launcher
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
828 B

4 years ago
  1. const { BrowserWindow } = require('electron')
  2. const path = require('path')
  3. const { MANUAL_CREATED_FLAG } = require('../../constant')
  4. function createWindow(url,options,node=false) {
  5. // let areaSize = require('electron').screen.getPrimaryDisplay().workAreaSize
  6. const window = new BrowserWindow({
  7. // width: 870,
  8. // height: 530,
  9. webPreferences: {
  10. webSecurity: false,
  11. contextIsolation: false,
  12. enableRemoteModule:true,
  13. nodeIntegration: node,
  14. preload: path.join(__dirname, 'preload.js')
  15. },
  16. ...options
  17. })
  18. window[MANUAL_CREATED_FLAG] = true
  19. console.log('openWindow', url)
  20. window.loadURL(url)
  21. // window.webContents.openDevTools() // Open the DevTools.
  22. return window
  23. }
  24. module.exports = { createWindow }