2016-08-13 24 views
7

我說使用電子,並試圖使盡量減少和關閉按鈕。原子電子關閉和最小化窗口使用HTML按鈕和JavaScript

的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方法 Atom Electron - Close the window with javascript 它的工作完美,但爲什麼我的函數方法不工作?

回答

6

哦,我解決了這個問題,只是通過改變函數名稱的close()函數的東西,它似乎像關閉是與其他功能或類似的東西衝突。

相關問題