I am using Electron app with a preload script and I am asigning ids with document.getElementById to vars and then I used that variables in a function. But because it is a preload script some vars are not set because the index file is not loaded fully (i guess). I have tried using window.onload function to wait for the window to fully load but this is not helping. Is there anything else I can do to set the vars correctly?