Why is it possible to write in node (electron) something like this:
app.on('ready', function() {
    mainWindow = new BrowserWindow({
        width: 800,
        height: 480
    });
});
but this thows an error that app is not ready?
app.on('ready', onReady());
function onReady() {
    mainWindow = new BrowserWindow({
        width: 800,
        height: 480
    });
}
 
    