Как вызвать функцию JavaScript на веб-странице, отображаемой Electron?

Я пытаюсь написать обертку длящебет с помощьюэлектрон (ранее Атом Шелл).

мойmain.js файл (выглядит почти идентичноПривет, мирНапример, я просто изменил его в одном месте)

var app = require('app');  // Module to control application life.
var BrowserWindow = require('browser-window');  // Module to create native browser window.

// Report crashes to our server.
require('crash-reporter').start();

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
  if (process.platform != 'darwin')
    app.quit();
});

// This method will be called when atom-shell has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {

  // Create the browser window.
  mainWindow = new BrowserWindow ({'width':1000,'height':600});
  // and load the index.html of the app.
  mainWindow.loadUrl('https://twitter.com');

  // Emitted when the window is closed.
  mainWindow.on('closed', function() {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });
});

Я пытаюсь позвонитьalert() функционировать сразу послеmainWindow.loadUrl() но это не выполняется.

Я это понимаюmain.js Файл похож на серверную часть моего приложения, но вопрос в том ... Как я могу вызвать функцию JavaScript на странице? Где я должен написать код?

Например, я хочу выполнить это:

$(document).ready(function() {
    alert("Hurray!");
});

Ответы на вопрос(3)

Ваш ответ на вопрос