【问题标题】:Atom Electron Close and Minimize window using the html button and javascriptAtom Electron 使用 html 按钮和 javascript 关闭和最小化窗口
【发布时间】:2016-12-20 07:15:08
【问题描述】:

我说使用 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 方法 Atom Electron - Close the window with javascript 而且效果很好,但是为什么我的函数方法不起作用??

【问题讨论】:

    标签: javascript electron


    【解决方案1】:

    哦,我只是通过将 close() 函数的函数名称更改为其他名称解决了这个问题,看起来 close 与其他函数或类似的东西冲突。

    【讨论】:

      猜你喜欢
      • 2015-09-19
      • 2016-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多