Atom Electron Close and Minimize window using html and javascript button

I said using Electron and trying to make the button collapse and close.

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 have to make some silly mistake or something, but the minimize button works fine while the close button doesn't work.

I also tried the EventListener method mentioned here by Atom Electron - Close the window using javascript And it works fine, but why doesn't my functional approach work?

+7
javascript electron
source share
1 answer

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

+6
source share

All Articles