I’m using powerSaveBlocker in my Electron app to prevent sleep, but the docs are quite presumptuous, and I’m not entirely sure what they expect. https://github.com/atom/electron/blob/master/docs/api/power-save-blocker.md
So I’m using
.start('prevent-display-sleep') on a page (in my SPA) and getting an ID back that I’m storing. On navigating away from the page, I’m using
But it’s possible to navigate between pages that start the powerSaveBlocker, so I need to know if I’ve already got one running, so I don’t have multiple powerSaveBlockers running at once. I realise I can use
.isStarted(id) to check if one has been started, but what does this return when it has been stopped? Does it error? Does it fail silently? Or does it just return
true (because technically it has been started)?
What if I try and stop one that has already been stopped? Are any stopped ones deleted, or do they linger indefinitely?
I don’t quite understand the structure of Electron to work it out for myself, unfortunately.