mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 05:51:55 +00:00
Rework faulty callback concept in ProcessManagerService
This commit is contained in:
parent
ceabfe75bc
commit
0779ad2ef6
@ -21,22 +21,19 @@ export class ProcessManagerService {
|
|||||||
.pipe(filter(message => message.data.process_name === process_name)).subscribe(callback);
|
.pipe(filter(message => message.data.process_name === process_name)).subscribe(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendCommand(command: string, process_name: string, callback?: (event: any) => void) {
|
sendCommand(command: string, process_name: string) {
|
||||||
if (callback) {
|
|
||||||
this.subscribeCallback(process_name, callback);
|
|
||||||
}
|
|
||||||
this.webSocketService.send(this.key, {'command': command, 'process_name': process_name});
|
this.webSocketService.send(this.key, {'command': command, 'process_name': process_name});
|
||||||
}
|
}
|
||||||
|
|
||||||
startProcess(process_name: string, callback?: (event: any) => void) {
|
startProcess(process_name: string) {
|
||||||
this.sendCommand('start', process_name, callback);
|
this.sendCommand('start', process_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
stopProcess(process_name: string, callback?: (event: any) => void) {
|
stopProcess(process_name: string) {
|
||||||
this.sendCommand('stop', process_name, callback);
|
this.sendCommand('stop', process_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
restartProcess(process_name: string, callback?: (event: any) => void) {
|
restartProcess(process_name: string) {
|
||||||
this.sendCommand('restart', process_name, callback);
|
this.sendCommand('restart', process_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ export class WebideComponent implements OnInit {
|
|||||||
this.subscribeWS();
|
this.subscribeWS();
|
||||||
this.requestCode();
|
this.requestCode();
|
||||||
this.processManagerService.init();
|
this.processManagerService.init();
|
||||||
|
this.processManagerService.subscribeCallback('login', (event) => { console.log('CICÁK!!'); });
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribeWS() {
|
subscribeWS() {
|
||||||
@ -89,7 +90,7 @@ export class WebideComponent implements OnInit {
|
|||||||
'content': this.code
|
'content': this.code
|
||||||
});
|
});
|
||||||
this.saveButtonState = 'SAVING';
|
this.saveButtonState = 'SAVING';
|
||||||
this.processManagerService.restartProcess('login', (event) => { console.log('CICÁK!!'); });
|
this.processManagerService.restartProcess('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
requestCode() {
|
requestCode() {
|
||||||
|
Loading…
Reference in New Issue
Block a user