Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Atom Electron Close and Minimize window using the html button and javascript

I stated using Electron and trying to make minimize and close button.

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();  
  }

I must be doing some silly mistake or what but minimize button works perfectly while close button not working.

I also tried EventListener method as mentioned here Atom Electron - Close the window with javascript And it works perfectly, but why my function approach isn't working??

like image 246
shubh jaiswal Avatar asked Aug 13 '16 11:08

shubh jaiswal


1 Answers

Oh, I Solved this problem just by changing function name of close() function to something else, it seems like close is conflicting with some other function or something like that.

like image 82
shubh jaiswal Avatar answered Nov 20 '22 02:11

shubh jaiswal