我正在尝试向index.html文件中的按钮添加功能,如下所示:我在按钮元素中index.html
<button id="auth-button">Authorize</button>
在main.js应用程序中,我有
require('crash-reporter').start();
console.log("oh yaeh!");
var mainWindow = null;
app.on('window-all-closed', function(){
    if(process.platform != 'darwin'){
        app.quit();
    }
});
app.on('ready',function(){
    mainWindow = new BrowserWindow({width:800, height : 600});
    mainWindow.loadUrl('file://' + __dirname + '/index.html');
    var authButton = document.getElementById("auth-button");
    authButton.addEventListener("click",function(){alert("clicked!");});
    mainWindow.openDevTools();
    mainWindow.on('closed',function(){
        mainWindow = null;
    });
});
但是会发生如下错误:
Uncaught Exception: ReferenceError: document is not defined
构建电子应用程序时可以访问DOM对象吗?还是有其他替代方法可以为我提供所需的功能?