AlexTorresDev / custom-electron-titlebar

Custom electon title bar inpire on VS Code title bar
MIT License
870 stars 149 forks source link

Extremely high close time. #130

Closed timlg07 closed 3 years ago

timlg07 commented 3 years ago

Describe the bug When using the custom-electron-titlebar it takes much longer to close a window. In numbers: The time between the call of the close and closed events is at

A possible "fix" would be to add

win.on("close", win.destroy)

which drives down the close time to around 5 - 10 ms, but seems like a bad idea to use.

Note: When using the custom-electron-titlebar it makes a difference whether you use frame: true or false. This is not the case when the custom-electron-titlebar is not used: The close time with the hidden frame is still very low at around 10 ms.

To Reproduce Steps to reproduce the behavior:

  1. Clone custom-electron-titlebar-minimal-example/tree/close-time-issue
  2. Install and start the application using npm
  3. Close the window when using frame: true and frame: false or with and without using the custom-electron-titlebar and read the console output.

Desktop:

lociero commented 3 years ago

@timlg07 This is a known bug of electron.

timlg07 commented 3 years ago

@lociero Thanks for the link, I didn't knew this. Looks like the beforeunload-listener used by the titlebar of this library causes this behaviour. Do you happen to know a good work around?

lociero commented 3 years ago

@timlg07 I'm just sitting on 8.5.5 since I didn't find any workaround.

timlg07 commented 3 years ago

@lociero hm that sucks... But thank you very much for the responses!

ericblade commented 3 years ago

I don't have any sort of problem like this, using 11

timlg07 commented 3 years ago

@ericblade What times do you get when you try out the example I linked? And which (custom-electron-titlebar) version are you on?