Compare commits
1 Commits
works
...
electronif
Author | SHA1 | Date | |
---|---|---|---|
36c307892d
|
@ -4,11 +4,12 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build && cp ./src/electron-app.js ./dist",
|
"build": "ng build",
|
||||||
"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": {
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
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()
|
|
||||||
}
|
|
||||||
})
|
|
34
tools/app/angular-tour-of-heroes/src/electron/mains.js
vendored
Normal file
34
tools/app/angular-tour-of-heroes/src/electron/mains.js
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
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()
|
||||||
|
}
|
||||||
|
})
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "angular-electron",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"main": "main.js"
|
||||||
|
}
|
@ -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'; // Included with Angular CLI.
|
import 'zone.js/dist/zone-mix'; // Included with Angular CLI.
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
|
Reference in New Issue
Block a user