This repository has been archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from mozilla-services/multi-platform
Multi-platform support
- Loading branch information
Showing
4 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict' | ||
const electron = require('electron') | ||
|
||
const app = electron.app // this is our app | ||
const BrowserWindow = electron.BrowserWindow // This is a Module that creates windows | ||
|
||
let mainWindow // saves a global reference to mainWindow so it doesn't get garbage collected | ||
|
||
app.on('ready', createWindow) // called when electron has initialized | ||
|
||
// This will create our app window, no surprise there | ||
function createWindow () { | ||
mainWindow = new BrowserWindow({ | ||
width: 1024, | ||
height: 768 | ||
}) | ||
|
||
// display the index.html file | ||
mainWindow.loadURL(`file://${ __dirname }/index.html`) | ||
|
||
// open dev tools by default so we can see any console errors | ||
//mainWindow.webContents.openDevTools() | ||
|
||
mainWindow.on('closed', function () { | ||
mainWindow = null | ||
}) | ||
} | ||
|
||
/* Mac Specific things */ | ||
|
||
// when you close all the windows on a non-mac OS it quits the app | ||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { app.quit() } | ||
}) | ||
|
||
// if there is no mainWindow it creates one (like when you click the dock icon) | ||
app.on('activate', () => { | ||
if (mainWindow === null) { createWindow() } | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters