1 namespace app.services{
3 private directiveIDs: string[];
5 constructor(private WebSocket: services.WebSocket,
6 private $rootScope: ng.IRootScopeService
8 this.WebSocket = WebSocket;
9 this.$rootScope = $rootScope;
10 this.directiveIDs = [];
12 const directiveIDs = this.directiveIDs;
14 this.WebSocket.on('console', (d) => {
16 const message = d.message;
19 if(directiveIDs.indexOf(id) > -1) {
20 $rootScope.$emit(id, message);
25 public addDirective(id: string) {
26 if(!(this.directiveIDs.indexOf(id) > -1)) {
27 this.directiveIDs.push(id);
31 public removeDirective(id: string) {
32 const i = this.directiveIDs.indexOf(id);
34 this.directiveIDs.splice(i,1);
39 console.log(this.directiveIDs);