Skip to content

Commit

Permalink
Merge pull request #1 from Mackignacio/Fix-compile-errors
Browse files Browse the repository at this point in the history
Fix compile errors
  • Loading branch information
mackignacio authored Jul 27, 2018
2 parents bdf6fac + a2817e8 commit 4210f8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 40 deletions.
50 changes: 11 additions & 39 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,18 @@ import * as path from "path";
import * as url from "url";
process.env["ELECTRON_DISABLE_SECURITY_WARNINGS"] = "true";

require("electron-reload")(__dirname, {
electron: require(`${__dirname}/node_modules/electron`)
});
let win;
function createWindow() {
win = new BrowserWindow({ width: 800, height: 600 });
win.loadURL(
url.format({
pathname: path.join(__dirname, "/dist/electron-angular/index.html"),
protocol: "file:",
slashes: true
})
);
win.webContents.openDevTools();
win.on("closed", () => {
app.quit();
});
}

app.on("ready", createWindow);

app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});

app.on("activate", () => {
if (win === null) {
createWindow();
}
});
class ElectronMain {
appTitle = "Electron Angular Quickstart";
args: any;
serve: boolean;
mainWindow: BrowserWindow;

constructor() {
app.on("ready", this.createMainWindow);
require("electron-reload")(__dirname, {
electron: require(`${__dirname}/node_modules/electron`)
});
this.checkElectronArgs();
this.initApp();
this.initIpc();
}

checkElectronArgs() {
this.args = process.argv.slice(1);
this.serve = this.args.some(val => val === "--serve");
Expand All @@ -60,8 +27,13 @@ class ElectronMain {

createMainWindow() {
this.mainWindow = new BrowserWindow({
x: 0,
y: 0
title: this.appTitle,
fullscreen: true,
minimizable: false,
maximizable: false,
autoHideMenuBar: true,
alwaysOnTop: true,
closable: false
});
this.mainWindow.loadURL(
url.format({
Expand Down Expand Up @@ -94,4 +66,4 @@ class ElectronMain {
initIpc() {}
}

// export default new ElectronMain();
export default new ElectronMain();
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"electron:serve": "wait-on ./dist/electron-angular/index.html && npm run electron:watch",
"ng:build": "ng build --base-href ./ --watch=true",
"electron:tsc": "tsc -w main.ts ",
"electron:watch": "concurrently --kill-others \"npm run electron:tsc \" \"electron . --serve\""
"electron:run": "wait-on main.js && electron . --serve",
"electron:watch": "concurrently --kill-others \"npm run electron:tsc \" \"npm run electron:run\""
},
"private": true,
"dependencies": {
Expand Down

0 comments on commit 4210f8b

Please sign in to comment.