This commit is contained in:
crusader 2018-08-25 17:52:44 +09:00
parent f6ad0caac5
commit f6834722b8
11 changed files with 84 additions and 86 deletions

View File

@ -8,4 +8,6 @@
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"git.ignoreLimitWarning": true,
"prettier.singleQuote": true
}

View File

@ -39,6 +39,7 @@
"@ngrx/schematics": "^6.1.0",
"@ngrx/store": "^6.1.0",
"@ngrx/store-devtools": "^6.1.0",
"@overflow/rpc-js": "0.0.4",
"@types/fs-extra": "^5.0.4",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",

View File

@ -13,7 +13,7 @@ export class AppComponent implements OnInit {
public constructor(
private electronProxyService: ElectronProxyService,
) {
this.showTitleBar = __WIN32__;
this.showTitleBar = !__LINUX__;
}
ngOnInit(): void {

View File

@ -8,16 +8,12 @@ const DatabaseVersion = 1;
providedIn: 'root'
})
export class DatabaseService extends Dexie {
public launches!: Dexie.Table<LaunchState, number>
public launches!: Dexie.Table<LaunchState, number>;
public constructor() {
super('overflow-scanner');
this.version(1).stores({
launches: '++',
launches: '++'
});
}
}

View File

@ -12,35 +12,36 @@ import { LaunchService } from './launch.service';
providedIn: 'root'
})
export class ElectronProxyService {
public constructor(
private store: Store<any>,
private launchService: LaunchService,
private launchService: LaunchService
) {
this.bindIpcEventHandlers();
}
private bindIpcEventHandlers(): void {
ipcRenderer.on('menu-event',
(event: Electron.IpcMessageEvent, { name }: { name: MenuEvent }) => {
}
ipcRenderer.on(
'menu-event',
(event: Electron.IpcMessageEvent, { name }: { name: MenuEvent }) => {}
);
ipcRenderer.on('launch-timing-stats',
ipcRenderer.on(
'launch-timing-stats',
(event: Electron.IpcMessageEvent, { state }: { state: LaunchState }) => {
console.info(`App ready time: ${state.mainReadyTime}ms`);
console.info(`Load time: ${state.loadTime}ms`);
console.info(`Renderer ready time: ${state.rendererReadyTime}ms`);
this.launchService.save(state).pipe(
map((id: number) => {
}),
this.launchService
.save(state)
.pipe(
map((id: number) => {}),
catchError(error => {
return of();
}),
take(1),
).subscribe();
take(1)
)
.subscribe();
}
);
}
@ -52,5 +53,4 @@ export class ElectronProxyService {
public getAppMenu(): void {
ipcRenderer.send('get-app-menu');
}
}

View File

@ -1,9 +1,11 @@
import { DatabaseService } from './database.service';
import { ElectronProxyService } from './electron-proxy.service';
import { LaunchService } from './launch.service';
import { ProbeService } from './probe.service';
export const SERVICES = [
DatabaseService,
ElectronProxyService,
LaunchService,
ProbeService
];

View File

@ -4,21 +4,15 @@ import { Observable, defer } from 'rxjs';
import { DatabaseService } from './database.service';
import { LaunchState } from '../model';
@Injectable({
providedIn: 'root'
})
export class LaunchService {
public constructor(
private readonly databaseService: DatabaseService,
) {
}
public constructor(private readonly databaseService: DatabaseService) {}
public save(launchState: LaunchState): Observable<number> {
return defer(async () => {
return await this.databaseService.launches.add(launchState);
});
}
}

View File

@ -0,0 +1,29 @@
import { Injectable } from '@angular/core';
import {
Client,
ClientNotificationCodec,
RxWebsocketRWC,
RxWebsocketSubjectConfig,
JSONClientCodec
} from '@overflow/rpc-js';
import { Subscription } from 'rxjs';
@Injectable()
export class ProbeService {
private probeClient: Client;
private notiSubscription: Subscription;
public constructor() {
const config: RxWebsocketSubjectConfig<any> = {
url: ''
};
const rwc = new RxWebsocketRWC(config);
const codec = new JSONClientCodec();
this.probeClient = new Client(codec, rwc);
this.notiSubscription = this.probeClient
.notification()
.subscribe((notiCodec: ClientNotificationCodec) => {
console.log(notiCodec.method());
});
}
}

View File

@ -10,7 +10,7 @@
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body class="platform-win32 theme-light">
<body class="platform-darwin theme-light">
<app-root></app-root>
</body>

View File

@ -1,36 +1,22 @@
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rulesDirectory": ["node_modules/codelyzer"],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"comment-format": [true, "check-space"],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs/Rx"
],
"import-blacklist": [true, "rxjs/Rx"],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"indent": [true, "spaces"],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"max-line-length": [true, 140],
"member-access": false,
"member-ordering": [
true,
@ -45,24 +31,14 @@
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
false,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-console": [false, "debug", "info", "time", "timeEnd", "trace"],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-inferrable-types": [true, "ignore-params"],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
@ -83,19 +59,10 @@
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"quotemark": [true, "single"],
"radix": true,
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"semicolon": [true, "always"],
"triple-equals": [true, "allow-null-check"],
"typedef-whitespace": [
true,
{

View File

@ -224,6 +224,13 @@
tree-kill "^1.0.0"
webpack-sources "^1.1.0"
"@overflow/rpc-js@0.0.4":
version "0.0.4"
resolved "https://nexus.loafle.net/repository/npm-all/@overflow/rpc-js/-/rpc-js-0.0.4.tgz#083577e4ca372c62bd8a529c29acca0163a1f6b6"
dependencies:
rxjs "^6.2.2"
url-join "^4.0.0"
"@schematics/angular@0.7.3":
version "0.7.3"
resolved "https://nexus.loafle.net/repository/npm-all/@schematics/angular/-/angular-0.7.3.tgz#d4a33a78b152bded557efddba4616a8fafa9ae24"