Electron (atom shell) window 一段时间后自行关闭

Electron (atom shell) window getting closed on its own after some time

只设置了一个使用 electron-prebuilt 的普通 Hello World 应用程序。 我通过 npm start 命令 运行 它。

Window 正常显示。但是,一段时间后它会自行关闭。

在命令提示符下它在 window 关闭之前抛出以下警告:

WARNING:raw_channel_win.cc(473)] WriteFile: The pipe is being closed. (0xE8)
WARNING:channel.cc(549)] Failed to send message to ack remove remote endpoint (local ID 1, remote ID 1)
WARNING:channel.cc(315)] RawChannel write error

是什么导致了这个问题?

npm 版本为 1.4.10 & node(通过 io.js)版本为 0.11.13(Windows 7 x64)

如@Oztaco 所述,在 QuickStart Guide 中有以下代码示例:

// 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;

// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 600});

  // other code ommited

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