committed by
László Monda
parent
49ec48c9e9
commit
4193cd0d1e
@@ -2,9 +2,13 @@ import { Component, ViewEncapsulation, HostListener } from '@angular/core';
|
|||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
|
||||||
import 'rxjs/add/operator/distinctUntilChanged';
|
import 'rxjs/add/operator/distinctUntilChanged';
|
||||||
|
import 'rxjs/add/operator/first';
|
||||||
import 'rxjs/add/operator/ignoreElements';
|
import 'rxjs/add/operator/ignoreElements';
|
||||||
|
import 'rxjs/add/operator/let';
|
||||||
|
import 'rxjs/add/operator/map';
|
||||||
import 'rxjs/add/operator/takeWhile';
|
import 'rxjs/add/operator/takeWhile';
|
||||||
|
|
||||||
import { AppState } from '../shared/store';
|
import { AppState } from '../shared/store';
|
||||||
@@ -42,6 +46,35 @@ export class MainAppComponent {
|
|||||||
this.sendUserConfiguration();
|
this.sendUserConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HostListener('window:keydown.alt.j', ['$event'])
|
||||||
|
onAltJ(event: KeyboardEvent): void {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
this.store
|
||||||
|
.let(getUserConfiguration())
|
||||||
|
.first()
|
||||||
|
.subscribe(userConfiguration => {
|
||||||
|
const asString = JSON.stringify(userConfiguration.toJsonObject());
|
||||||
|
const asBlob = new Blob([asString], { type: 'text/plain' });
|
||||||
|
saveAs(asBlob, 'UserConfiguration.json');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@HostListener('window:keydown.alt.b', ['$event'])
|
||||||
|
onAltB(event: KeyboardEvent): void {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
this.store
|
||||||
|
.let(getUserConfiguration())
|
||||||
|
.first()
|
||||||
|
.map(userConfiguration => {
|
||||||
|
const uhkBuffer = new UhkBuffer();
|
||||||
|
userConfiguration.toBinary(uhkBuffer);
|
||||||
|
return new Blob([uhkBuffer.getBufferContent()]);
|
||||||
|
})
|
||||||
|
.subscribe(blob => saveAs(blob, 'UserConfiguration.bin'));
|
||||||
|
}
|
||||||
|
|
||||||
private sendUserConfiguration(): void {
|
private sendUserConfiguration(): void {
|
||||||
this.store
|
this.store
|
||||||
.let(getUserConfiguration())
|
.let(getUserConfiguration())
|
||||||
|
|||||||
Reference in New Issue
Block a user