21 lines
590 B
TypeScript
21 lines
590 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { WebSocketService } from './websocket.service';
|
|
|
|
import { FSMUpdateMessage } from '../message-types/fsm-update-message';
|
|
|
|
@Injectable()
|
|
export class FSMUpdateService {
|
|
public current_state: string;
|
|
public valid_transitions: object;
|
|
|
|
constructor(private websocketService: WebSocketService) {}
|
|
|
|
public init(): void {
|
|
this.websocketService.observeKey<FSMUpdateMessage>('fsm.update').subscribe(message => {
|
|
this.current_state = message.current_state;
|
|
this.valid_transitions = message.valid_transitions;
|
|
});
|
|
}
|
|
|
|
}
|