blob: 88bd76eb6e10b6588ffd04e127e658ce1b759cef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import {Component, OnDestroy, OnInit} from '@angular/core';
import {DesignerStore} from '../designer.store';
import {PackageCreationStore} from '../../package-creation/package-creation.store';
import {Subject} from 'rxjs';
import {distinctUntilChanged, takeUntil} from 'rxjs/operators';
import {CBAPackage} from '../../package-creation/mapping-models/CBAPacakge.model';
@Component({
selector: 'app-functions-attribute',
templateUrl: './functions-attribute.component.html',
styleUrls: ['./functions-attribute.component.css']
})
export class FunctionsAttributeComponent implements OnInit, OnDestroy {
ngUnsubscribe = new Subject();
private designerDashboardState: DecodeSuccessCallback;
private cbaPackage: CBAPackage;
constructor(private designerStore: DesignerStore,
private packageCreationStore: PackageCreationStore) {
}
ngOnInit() {
this.designerStore.state$
.pipe(
distinctUntilChanged((a: any, b: any) => JSON.stringify(a) === JSON.stringify(b)),
takeUntil(this.ngUnsubscribe))
.subscribe(designerDashboardState => {
this.designerDashboardState = designerDashboardState;
});
this.packageCreationStore.state$
.pipe(
distinctUntilChanged((a: any, b: any) => JSON.stringify(a) === JSON.stringify(b)),
takeUntil(this.ngUnsubscribe))
.subscribe(cbaPackage => {
this.cbaPackage = cbaPackage;
});
}
ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
}
}
|