Compare commits
1 Commits
electronif
...
works
Author | SHA1 | Date | |
---|---|---|---|
c6e338502e
|
@ -4,12 +4,11 @@
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"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",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"build-electron": "ng build --base-href . && cp src/electron/* dist/",
|
||||
"electron": "npm run build-electron && ./node_modules/.bin/electron dist/"
|
||||
"e2e": "ng e2e"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
30
tools/app/angular-tour-of-heroes/src/electron-app.js
vendored
Normal file
30
tools/app/angular-tour-of-heroes/src/electron-app.js
vendored
Normal 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()
|
||||
}
|
||||
})
|
@ -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()
|
||||
}
|
||||
})
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "angular-electron",
|
||||
"version": "0.1.0",
|
||||
"main": "main.js"
|
||||
}
|
@ -55,7 +55,7 @@
|
||||
/***************************************************************************************************
|
||||
* 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.
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
|
Reference in New Issue
Block a user