Seperate electron and web target building
This commit is contained in:
committed by
József Farkas
parent
517aed1b1c
commit
983eb72892
2
electron/src/main-app/index.ts
Normal file
2
electron/src/main-app/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './main-app.component';
|
||||
export * from './main-app.routes';
|
||||
67
electron/src/main-app/main-app.component.ts
Normal file
67
electron/src/main-app/main-app.component.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { Component, ViewEncapsulation, HostListener } from '@angular/core';
|
||||
|
||||
// import { Observable } from 'rxjs/Observable';
|
||||
|
||||
// import { Store } from '@ngrx/store';
|
||||
// import { AppState } from '../store';
|
||||
// import { DataStorage } from '../store/storage';
|
||||
// import { getKeymapEntities, getMacroEntities } from '../store/reducers';
|
||||
|
||||
// import { UhkBuffer } from '../config-serializer/UhkBuffer';
|
||||
// import { UserConfiguration } from '../config-serializer/config-items/UserConfiguration';
|
||||
|
||||
// import { UhkDeviceService } from '../services/uhk-device.service';
|
||||
|
||||
@Component({
|
||||
selector: 'main-app',
|
||||
template: require('../shared/main-app/main-app.component.html'),
|
||||
styles: [require('../shared/main-app/main-app.component.scss')],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class MainAppComponent {
|
||||
|
||||
// private configuration$: Observable<UserConfiguration>;
|
||||
|
||||
constructor(
|
||||
// private uhkDevice: UhkDeviceService,
|
||||
// store: Store<AppState>,
|
||||
// dataStorage: DataStorage
|
||||
) {
|
||||
// this.configuration$ = store.let(getKeymapEntities())
|
||||
// .combineLatest(store.let(getMacroEntities()))
|
||||
// .map((pair) => {
|
||||
// const config = new UserConfiguration();
|
||||
// Object.assign(config, dataStorage.getConfiguration());
|
||||
// config.keymaps = pair[0];
|
||||
// config.macros = pair[1];
|
||||
// return config;
|
||||
// });
|
||||
}
|
||||
|
||||
@HostListener('window:keydown.control.o', ['$event'])
|
||||
onCtrlO(event: KeyboardEvent): void {
|
||||
console.log('ctrl + o pressed');
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.sendConfiguration();
|
||||
}
|
||||
|
||||
private sendConfiguration(): void {
|
||||
// this.configuration$
|
||||
// .first()
|
||||
// .map(configuration => {
|
||||
// const uhkBuffer = new UhkBuffer();
|
||||
// configuration.toBinary(uhkBuffer);
|
||||
// return uhkBuffer.getBufferContent();
|
||||
// })
|
||||
// .switchMap((buffer: Buffer) => this.uhkDevice.sendConfig(buffer))
|
||||
// .do(response => console.log('Sending config finished', response))
|
||||
// .switchMap(() => this.uhkDevice.applyConfig())
|
||||
// .subscribe(
|
||||
// (response) => console.log('Applying config finished', response),
|
||||
// error => console.error('Error during uploading config', error),
|
||||
// () => console.log('Config has been sucessfully uploaded')
|
||||
// );
|
||||
}
|
||||
|
||||
}
|
||||
18
electron/src/main-app/main-app.routes.ts
Normal file
18
electron/src/main-app/main-app.routes.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { ModuleWithProviders } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { addOnRoutes } from '../shared/components/add-on';
|
||||
import { keymapRoutes } from '../components/keymap';
|
||||
import { macroRoutes } from '../shared/components/macro';
|
||||
import { settingsRoutes } from '../shared/components/settings';
|
||||
|
||||
const appRoutes: Routes = [
|
||||
...keymapRoutes,
|
||||
...macroRoutes,
|
||||
...addOnRoutes,
|
||||
...settingsRoutes
|
||||
];
|
||||
|
||||
export const appRoutingProviders: any[] = [ ];
|
||||
|
||||
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes, { useHash: true });
|
||||
Reference in New Issue
Block a user