我已经声明了我的窗口:
const electron = require('electron')
const path = require('path')
const BrowserWindow = electron.remote.BrowserWindow
const notifyBtn = document.getElementById('notifyBtn')
notifyBtn.addEventListener('click',function(event){
const modalPath = path.join('file://', __dirname,'add.html')
let win = new BrowserWindow({ webPreferences: {nodeIntegration: true}, frame: false, transparent: true, alwaysOnTop:true, width: 400, height: 200 })
win.on('close',function(){win = null})
win.loadURL(modalPath)
win.show()
})
并关闭这个:
const electron = require('electron')
const path = require('path')
const remote = electron.remote
const closeBtn = document.getElementById('closeBtn')
closeBtn.addEventListener('click', function (event) {
var window = remote.getCurrentWindow();
window.close();
})