fix: fixing eslint problems
This commit is contained in:
2
workspaces/angular-app/.gitignore
vendored
2
workspaces/angular-app/.gitignore
vendored
@@ -1,7 +1,7 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/dist
|
||||
/.dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
# Only exists if Bazel was run
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "./dist",
|
||||
"outputPath": "./.dist/angular-app",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
|
||||
@@ -32,6 +32,6 @@
|
||||
"karma-coverage": "~2.0.3",
|
||||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "~1.7.0",
|
||||
"typescript": "~4.3.2"
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { AppComponent } from './app.component';
|
||||
import { MutiplesComponent } from './components/mutiples/mutiples.component';
|
||||
|
||||
// AoT requires an exported function for factories
|
||||
export function HttpLoaderFactory(http: HttpClient) {
|
||||
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
||||
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export class MutiplesComponent implements OnInit {
|
||||
input: new FormControl(Math.round(Math.random() * 100) % 10),
|
||||
});
|
||||
|
||||
multiples = [];
|
||||
multiples: number[] = [];
|
||||
|
||||
constructor(
|
||||
private electronIpc: ElectronIpcService,
|
||||
@@ -23,13 +23,16 @@ export class MutiplesComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
// Specifying what to do with received data from main process
|
||||
this.electronIpc.receive(WindowApiConst.MULTIPLES_OUTPUT, (...data: []) => {
|
||||
// Update current data
|
||||
this.multiples = data;
|
||||
});
|
||||
this.electronIpc.receive<number[]>(
|
||||
WindowApiConst.MULTIPLES_OUTPUT,
|
||||
(output: number[]) => {
|
||||
// Update current data
|
||||
this.multiples = output;
|
||||
}
|
||||
);
|
||||
|
||||
// Reset multiples on form changes
|
||||
this.timesTableForm.valueChanges.subscribe((value) => {
|
||||
this.timesTableForm.valueChanges.subscribe(() => {
|
||||
this.multiples = [];
|
||||
});
|
||||
|
||||
@@ -37,12 +40,12 @@ export class MutiplesComponent implements OnInit {
|
||||
this.onSubmit();
|
||||
}
|
||||
|
||||
translateIn(lang: string) {
|
||||
translateIn(lang: string): void {
|
||||
this.translate.use(lang);
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
const intput = this.timesTableForm.value.input;
|
||||
this.electronIpc.send(WindowApiConst.MULTIPLES_INPUT, intput);
|
||||
onSubmit(): void {
|
||||
const input = this.timesTableForm.value.input;
|
||||
this.electronIpc.send(WindowApiConst.MULTIPLES_INPUT, input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,37 +8,33 @@ export class ElectronIpcService {
|
||||
private _api!: WindowApi;
|
||||
|
||||
constructor(private zone: NgZone) {
|
||||
if (window && (window as any).api) {
|
||||
try {
|
||||
this._api = (window as any).api;
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
if (window && (window as Window).api) {
|
||||
this._api = (window as Window).api;
|
||||
console.log('Preloader API has been loaded successfully');
|
||||
} else {
|
||||
console.warn('Preloader API is not loaded');
|
||||
}
|
||||
}
|
||||
|
||||
public receive(channel: string, func: (...data: any) => void): void {
|
||||
public receive<Out>(channel: string, func: (output: Out) => void): void {
|
||||
if (this._api) {
|
||||
this._api.receive(channel, (...data) => {
|
||||
console.log(`Received from main process channel [${channel}]`, data);
|
||||
this._api.receive<Out>(channel, (output) => {
|
||||
console.log(`Received from main process channel [${channel}]`, output);
|
||||
|
||||
// Next code might run outside of Angular zone and therefore Angular
|
||||
// doesn't recognize it needs to run change detection
|
||||
// Further details on SO : https://stackoverflow.com/a/49136353/11480016
|
||||
this.zone.run(() => {
|
||||
func(...data);
|
||||
func(output);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public send(channel: string, ...data: any): void {
|
||||
public send<In>(channel: string, input: In): void {
|
||||
if (this._api) {
|
||||
console.log(`Sending to main process channel [${channel}]`, data);
|
||||
this._api.send(channel, ...data);
|
||||
console.log(`Sending to main process channel [${channel}]`, input);
|
||||
this._api.send<In>(channel, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"outDir": "./.dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
|
||||
Reference in New Issue
Block a user