blob: 598d23c8ea35a7499e7fba3688250c40672da522 [file] [log] [blame]
Matteo Scandolo63e43eb2016-12-14 14:18:53 -08001/// <reference path="../../../../typings/index.d.ts"/>
2
3import {Subject} from 'rxjs/Rx';
4import {IWSEvent, IWSEventService} from '../websocket/global';
5
6export class SynchronizerStore {
7 static $inject = ['WebSocket'];
8 private _notifications: Subject<IWSEvent> = new Subject();
9 constructor(
10 private webSocket: IWSEventService
11 ) {
12 this.webSocket.list()
13 .filter((e: IWSEvent) => {
14 return e.msg.changed_fields.indexOf('backend_status') > -1;
15 })
16 .subscribe(
17 (event: IWSEvent) => {
18 this._notifications.next(event);
19 }
20 );
21 }
22
23 query() {
24 return this._notifications.asObservable();
25 }
26}