To check on the state of backgroundThrottling
I want to access the webContents
inside an event handler:
window.addEventListener('blur', ()=>{
if(window.webContents.backgroundThrottling)
...
});
But when the event occurs I get the error message: "Cannot read property 'backgroundThrottling' of undefined". I tried a few things, but I could never get a defined webContents
.
As requested I add: This runs in index.html, so the renderer process? The window "was just available". I don't know where it was defined (but neither in index.html nor in renderer.js). (I'm quite new to JS and even newer to Electron.)
When I print the window in console.log
I get:
global {window: global, self: global, document: ...
So maybe this isn't the browser window, but the Electron one? But how do I get the browser window from within index.html (not creating a new one, but getting the current one)?
EDIT: But since it has all of my document's things in it it should be the browser window, shouldn't it?