mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-06-29 11:05:11 +00:00
Rework faulty callback concept in ProcessManagerService
This commit is contained in:
@ -21,22 +21,19 @@ export class ProcessManagerService {
|
||||
.pipe(filter(message => message.data.process_name === process_name)).subscribe(callback);
|
||||
}
|
||||
|
||||
sendCommand(command: string, process_name: string, callback?: (event: any) => void) {
|
||||
if (callback) {
|
||||
this.subscribeCallback(process_name, callback);
|
||||
}
|
||||
sendCommand(command: string, process_name: string) {
|
||||
this.webSocketService.send(this.key, {'command': command, 'process_name': process_name});
|
||||
}
|
||||
|
||||
startProcess(process_name: string, callback?: (event: any) => void) {
|
||||
this.sendCommand('start', process_name, callback);
|
||||
startProcess(process_name: string) {
|
||||
this.sendCommand('start', process_name);
|
||||
}
|
||||
|
||||
stopProcess(process_name: string, callback?: (event: any) => void) {
|
||||
this.sendCommand('stop', process_name, callback);
|
||||
stopProcess(process_name: string) {
|
||||
this.sendCommand('stop', process_name);
|
||||
}
|
||||
|
||||
restartProcess(process_name: string, callback?: (event: any) => void) {
|
||||
this.sendCommand('restart', process_name, callback);
|
||||
restartProcess(process_name: string) {
|
||||
this.sendCommand('restart', process_name);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user