1 import {Component, OnDestroy, OnInit} from '@angular/core';
2 import {DesignerStore} from '../designer.store';
3 import {PackageCreationStore} from '../../package-creation/package-creation.store';
4 import {Subject} from 'rxjs';
5 import {distinctUntilChanged, takeUntil} from 'rxjs/operators';
6 import {CBAPackage} from '../../package-creation/mapping-models/CBAPacakge.model';
9 selector: 'app-functions-attribute',
10 templateUrl: './functions-attribute.component.html',
11 styleUrls: ['./functions-attribute.component.css']
13 export class FunctionsAttributeComponent implements OnInit, OnDestroy {
15 ngUnsubscribe = new Subject();
16 private designerDashboardState: DecodeSuccessCallback;
17 private cbaPackage: CBAPackage;
19 constructor(private designerStore: DesignerStore,
20 private packageCreationStore: PackageCreationStore) {
24 this.designerStore.state$
26 distinctUntilChanged((a: any, b: any) => JSON.stringify(a) === JSON.stringify(b)),
27 takeUntil(this.ngUnsubscribe))
28 .subscribe(designerDashboardState => {
29 this.designerDashboardState = designerDashboardState;
32 this.packageCreationStore.state$
34 distinctUntilChanged((a: any, b: any) => JSON.stringify(a) === JSON.stringify(b)),
35 takeUntil(this.ngUnsubscribe))
36 .subscribe(cbaPackage => {
37 this.cbaPackage = cbaPackage;
43 this.ngUnsubscribe.next();
44 this.ngUnsubscribe.complete();