frontend-tutorial-framework/src/app/fsmupdate.service.ts
2018-02-01 16:38:56 +01:00

21 lines
560 B
TypeScript

import { Injectable } from '@angular/core';
import { WebSocketService } from './websocket.service';
import { FSMUpdate } from './fsmupdate';
@Injectable()
export class FSMUpdateService {
public current_state: string;
public valid_transitions: object;
constructor(private websocketService: WebSocketService) {}
public init(): void {
this.websocketService.observeAnchor<FSMUpdate>('FSMUpdate').subscribe((event) => {
this.current_state = event.data.current_state;
this.valid_transitions = event.data.valid_transitions;
});
}
}