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

20
.vscode/settings.json vendored
View File

@ -1,11 +1,13 @@
{ {
"editor.tabSize": 2, "editor.tabSize": 2,
"editor.insertSpaces": true, "editor.insertSpaces": true,
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.formatOnPaste": true, "editor.formatOnPaste": true,
"editor.autoClosingBrackets": true, "editor.autoClosingBrackets": true,
"editor.trimAutoWhitespace": true, "editor.trimAutoWhitespace": true,
"files.trimTrailingWhitespace": true, "files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true, "files.trimFinalNewlines": true,
"git.ignoreLimitWarning": true, "git.ignoreLimitWarning": true,
"prettier.singleQuote": true
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,21 +4,15 @@ import { Observable, defer } from 'rxjs';
import { DatabaseService } from './database.service'; import { DatabaseService } from './database.service';
import { LaunchState } from '../model'; import { LaunchState } from '../model';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class LaunchService { export class LaunchService {
public constructor(private readonly databaseService: DatabaseService) {}
public constructor(
private readonly databaseService: DatabaseService,
) {
}
public save(launchState: LaunchState): Observable<number> { public save(launchState: LaunchState): Observable<number> {
return defer(async () => { return defer(async () => {
return await this.databaseService.launches.add(launchState); 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"> <link rel="icon" type="image/x-icon" href="favicon.ico">
</head> </head>
<body class="platform-win32 theme-light"> <body class="platform-darwin theme-light">
<app-root></app-root> <app-root></app-root>
</body> </body>

View File

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

View File

@ -224,6 +224,13 @@
tree-kill "^1.0.0" tree-kill "^1.0.0"
webpack-sources "^1.1.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": "@schematics/angular@0.7.3":
version "0.7.3" version "0.7.3"
resolved "https://nexus.loafle.net/repository/npm-all/@schematics/angular/-/angular-0.7.3.tgz#d4a33a78b152bded557efddba4616a8fafa9ae24" resolved "https://nexus.loafle.net/repository/npm-all/@schematics/angular/-/angular-0.7.3.tgz#d4a33a78b152bded557efddba4616a8fafa9ae24"