mirror of
https://gitlab.com/openlp/web-remote.git
synced 2024-12-22 11:32:47 +00:00
Update the State Management code
This commit is contained in:
parent
24c74ab3c9
commit
2d8ee13fc7
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@openlp/web-remote",
|
||||
"version": "0.9.3",
|
||||
"version": "0.9.4",
|
||||
"description": "The web remote for OpenLP, written in Angular",
|
||||
"keywords": ["OpenLP", "Angular", "Remote"],
|
||||
"homepage": "https://openlp.org/",
|
||||
|
@ -12,7 +12,7 @@ export class MainViewComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.updateImage();
|
||||
this.openlpService.liveChanged$.subscribe(item => this.updateImage());
|
||||
this.openlpService.stateChanged$.subscribe(item => this.updateImage());
|
||||
}
|
||||
|
||||
updateImage(): void {
|
||||
|
@ -36,7 +36,6 @@ const httpOptions = {
|
||||
export class OpenLPService {
|
||||
private apiURL: string;
|
||||
public stateChanged$: EventEmitter<State>;
|
||||
public liveChanged$: EventEmitter<State>;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
const host = window.location.hostname;
|
||||
@ -51,7 +50,7 @@ export class OpenLPService {
|
||||
|
||||
this.stateChanged$ = new EventEmitter<State>();
|
||||
this.retrieveSystemInformation().subscribe(info => {
|
||||
const ws = new WebSocket(`ws://${host}:${info.websocket_port}/state`);
|
||||
const ws = new WebSocket(`ws://${host}:${info.websocket_port}`);
|
||||
ws.onmessage = (event) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
@ -61,18 +60,6 @@ export class OpenLPService {
|
||||
reader.readAsText(event.data);
|
||||
};
|
||||
});
|
||||
this.liveChanged$ = new EventEmitter<State>();
|
||||
this.retrieveSystemInformation().subscribe(info => {
|
||||
const ws = new WebSocket(`ws://${host}:${info.websocket_port}/live_changed`);
|
||||
ws.onmessage = (event) => {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
const state = deserialize(JSON.parse(reader.result as string).results, State);
|
||||
this.liveChanged$.emit(state);
|
||||
};
|
||||
reader.readAsText(event.data);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
setAuthToken(token: string): void {
|
||||
|
Loading…
Reference in New Issue
Block a user