Angular src restructured as modular as per angular official guidelines, .travis.yml support added for node 12
This commit is contained in:
10
src/app/core/core.module.ts
Normal file
10
src/app/core/core.module.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
@NgModule({
|
||||
declarations: [],
|
||||
imports: [
|
||||
CommonModule
|
||||
]
|
||||
})
|
||||
export class CoreModule { }
|
||||
12
src/app/core/services/electron/electron.service.spec.ts
Normal file
12
src/app/core/services/electron/electron.service.spec.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ElectronService } from './electron.service';
|
||||
|
||||
describe('ElectronService', () => {
|
||||
beforeEach(() => TestBed.configureTestingModule({}));
|
||||
|
||||
it('should be created', () => {
|
||||
const service: ElectronService = TestBed.get(ElectronService);
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
34
src/app/core/services/electron/electron.service.ts
Normal file
34
src/app/core/services/electron/electron.service.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
// If you import a module but never use any of the imported values other than as TypeScript types,
|
||||
// the resulting javascript file will look as if you never imported the module at all.
|
||||
import { ipcRenderer, webFrame, remote } from 'electron';
|
||||
import * as childProcess from 'child_process';
|
||||
import * as fs from 'fs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ElectronService {
|
||||
ipcRenderer: typeof ipcRenderer;
|
||||
webFrame: typeof webFrame;
|
||||
remote: typeof remote;
|
||||
childProcess: typeof childProcess;
|
||||
fs: typeof fs;
|
||||
|
||||
get isElectron() {
|
||||
return window && window.process && window.process.type;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
// Conditional imports
|
||||
if (this.isElectron) {
|
||||
this.ipcRenderer = window.require('electron').ipcRenderer;
|
||||
this.webFrame = window.require('electron').webFrame;
|
||||
this.remote = window.require('electron').remote;
|
||||
|
||||
this.childProcess = window.require('child_process');
|
||||
this.fs = window.require('fs');
|
||||
}
|
||||
}
|
||||
}
|
||||
1
src/app/core/services/index.ts
Normal file
1
src/app/core/services/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './electron/electron.service';
|
||||
Reference in New Issue
Block a user