Comment appeler une fonction JavaScript sur une page web rendue par Electron?

Je suis en train d'écrire un wrapper pour Twitter à l'aide de D'électrons (anciennement Atome Shell).

Mon main.js fichier (elle est presque identique à la "Bonjour Tout Le Monde", par exemple, je viens de changer cela en un seul endroit):

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;
  });
});

J'essaie d'appeler alert() fonction juste après mainWindow.loadUrl() mais il ne les exécute pas.

Je comprends que main.js fichier, c'est comme le côté serveur de mon application, mais la question est... Comment puis-je appeler une fonction JavaScript sur la page? Où dois-je écrire le code?

Par exemple, je veux faire:

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

source d'informationauteur evlogii