Переглянути джерело

Merge pull request #9 from tcyrus/tcyrus-patch-1

Made Changes Based on Electron Quick Start Guide
Kevin Sawicki 10 роки тому
батько
коміт
25e99f79b1
2 змінених файлів з 8 додано та 5 видалено
  1. 1 0
      index.html
  2. 7 5
      main.js

+ 1 - 0
index.html

@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <meta charset="UTF-8">
     <title>Hello World!</title>
   </head>
   <body>

+ 7 - 5
main.js

@@ -1,12 +1,14 @@
-var app = require('app');  // Module to control application life.
-var BrowserWindow = require('browser-window');  // Module to create native browser window.
+'use strict';
+const electron = require('electron');
+const app = electron.app;  // Module to control application life.
+const BrowserWindow = electron.BrowserWindow;  // Module to create native browser window.
 
 // Report crashes to our server.
-require('crash-reporter').start();
+electron.crashReporter.start();
 
 // Keep a global reference of the window object, if you don't, the window will
 // be closed automatically when the JavaScript object is garbage collected.
-var mainWindow = null;
+let mainWindow;
 
 // Quit when all windows are closed.
 app.on('window-all-closed', function() {
@@ -24,7 +26,7 @@ app.on('ready', function() {
   mainWindow = new BrowserWindow({width: 800, height: 600});
 
   // and load the index.html of the app.
-  mainWindow.loadUrl('file://' + __dirname + '/index.html');
+  mainWindow.loadUrl(`file://${__dirname}/index.html`);
 
   // Open the DevTools.
   mainWindow.webContents.openDevTools();