aboutsummaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'main.js')
-rw-r--r--main.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/main.js b/main.js
new file mode 100644
index 0000000..d07a8bf
--- /dev/null
+++ b/main.js
@@ -0,0 +1,40 @@
+const {app, BrowserWindow} = require('electron')
+const path = require('path')
+const url = require('url')
+let win
+
+function createWindow () {
+ // Create the browser window.
+ win = new BrowserWindow({width: 800, height: 600})
+
+ // and load the index.html of the app.
+ win.loadURL(url.format({
+ pathname: path.join(__dirname, 'index.html'),
+ protocol: 'file:',
+ slashes: true
+ }))
+
+ // Open the DevTools.
+ // win.webContents.openDevTools()
+
+ // Emitted when the window is closed.
+ win.on('closed', () => {
+ // 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.
+ win = null
+ })
+}
+app.on('ready', createWindow)
+
+app.on('window-all-closed', () => {
+ if (process.platform !== 'darwin') {
+ app.quit()
+ }
+})
+
+app.on('activate', () => {
+ if (win === null) {
+ createWindow()
+ }
+}) \ No newline at end of file