Best practice to load settings to the web application
I can't claim to be familiar with Electron, but after looking at the documentation and an example on github, it appears that an electron convention is to use app.on/app.once


var electron = require('electron') // http://electron.atom.io/docs/api
var path = require('path')         // https://nodejs.org/api/path.html
var url = require('url')           // https://nodejs.org/api/url.html
var window = null
// Wait until the app is ready
electron.app.once('ready', function () {
  // Create a new window
});



In general, Javascript developers can subscribe to the readystatechange event as you have done, as well as use document.addEventListener() to subscribe to the DOMContentLoaded event:



document.onreadystatechange = function(){
  console.log('document readystate: ',document.readyState);
}
document.addEventListener('DOMContentLoaded',function() {
  console.log('DOM Load: document readystate: ',document.readyState);
})




You might find this SO post interesting...