mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-01-16 19:51:56 +00:00
26 lines
595 B
TypeScript
26 lines
595 B
TypeScript
|
import { Injectable } from '@angular/core';
|
||
|
import { WebSocketService } from './websocket.service';
|
||
|
|
||
|
|
||
|
class FSMUpdate {
|
||
|
current_state: string;
|
||
|
valid_transitions: object;
|
||
|
}
|
||
|
|
||
|
|
||
|
@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;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
}
|