Atom Electron 使用 html 按钮和 javascript 关闭并最小化 window
Atom Electron Close and Minimize window using the html button and javascript
我说使用 Electron 并尝试制作最小化和关闭按钮。
index.html
<button id="minus" onclick="minimize()">minimize</span></button>
<button id="close" onclick="close()">close</span></button>
index.js
const remote = require('electron').remote;
function minimize(){
var window = remote.getCurrentWindow();
window.minimize();
}
function close(){
var window = remote.getCurrentWindow();
window.close();
}
我一定是犯了一些愚蠢的错误或者什么但是最小化按钮工作正常而关闭按钮不起作用。
我也试过这里提到的 EventListener 方法
而且效果很好,但为什么我的函数方法不起作用??
哦,我只是通过将 close() 函数的函数名称更改为其他名称来解决这个问题,似乎 close 与其他函数或类似的东西冲突。
我说使用 Electron 并尝试制作最小化和关闭按钮。
index.html
<button id="minus" onclick="minimize()">minimize</span></button>
<button id="close" onclick="close()">close</span></button>
index.js
const remote = require('electron').remote;
function minimize(){
var window = remote.getCurrentWindow();
window.minimize();
}
function close(){
var window = remote.getCurrentWindow();
window.close();
}
我一定是犯了一些愚蠢的错误或者什么但是最小化按钮工作正常而关闭按钮不起作用。
我也试过这里提到的 EventListener 方法
哦,我只是通过将 close() 函数的函数名称更改为其他名称来解决这个问题,似乎 close 与其他函数或类似的东西冲突。