2 * Copyright (c) 2017 ZTE Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * and the Apache License 2.0 which both accompany this distribution,
6 * and are available at http://www.eclipse.org/legal/epl-v10.html
7 * and http://www.apache.org/licenses/LICENSE-2.0
10 * ZTE - initial API and implementation and/or initial documentation
12 import { Injectable } from '@angular/core';
13 import { Subject } from 'rxjs/Subject';
15 import { WorkflowNode } from '../model/workflow/workflow-node';
19 * All of the observable subject should be registered to this service.
20 * It provider a broadcast method to broadcast data. the broadcast method would catch error while broadcasting.
23 export class BroadcastService {
25 public jsPlumbInstance = new Subject<any>();
26 public jsPlumbInstance$ = this.jsPlumbInstance.asObservable();
28 public showProperty = new Subject<boolean>();
29 public showProperty$ = this.showProperty.asObservable();
31 public saveEvent = new Subject<string>();
32 public saveEvent$ = this.saveEvent.asObservable();
34 public nodeProperty = new Subject<WorkflowNode>();
35 public nodeProperty$ = this.nodeProperty.asObservable();
39 * this method will catch the exceptions for the broadcast
40 * @param subject will broadcast data
41 * @param data will be broadcated
43 public broadcast(subject: Subject<any>, data: any) {