1 Commits

Author SHA1 Message Date
c6e338502e seems to be working like this 2021-01-12 17:56:59 +01:00
5 changed files with 34 additions and 44 deletions

View File

@ -4,12 +4,11 @@
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build", "build": "ng build && cp ./src/electron-app.js ./dist",
"electron-start": "./node_modules/.bin/electron dist/electron-app.js",
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e", "e2e": "ng e2e"
"build-electron": "ng build --base-href . && cp src/electron/* dist/",
"electron": "npm run build-electron && ./node_modules/.bin/electron dist/"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {

View File

@ -0,0 +1,30 @@
const { create } = require('domain')
const { app, BrowserWindow } = require('electron')
let mainWindow
function createWindow() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
autoHideMenuBar: false
})
mainWindow.loadURL('file://' + __dirname + '/angular-tour-of-heroes/index.html')
mainWindow.webContents.openDevTools()
mainWindow.on('closed', () => {
mainWindow = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
})

View File

@ -1,34 +0,0 @@
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
const path = require('path')
const url = requite('url')
let mainWindow
function createWindow() {
mainWindow = new BrowserWindow({width: 800, height: 600})
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file',
slashes: true
}))
mainWindow.webContents.openDevTools()
mainWindow.on('closed', function() {
mainWindow = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', function() {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function() {
if (mainWindow === null) {
createWindow()
}
})

View File

@ -1,5 +0,0 @@
{
"name": "angular-electron",
"version": "0.1.0",
"main": "main.js"
}

View File

@ -55,7 +55,7 @@
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by default for Angular itself. * Zone JS is required by default for Angular itself.
*/ */
import 'zone.js/dist/zone-mix'; // Included with Angular CLI. import 'zone.js/dist/zone'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************