Hi,
my question is about BehaviorSubject:
I’ve defined them in this way:
public mobileLatitude: BehaviorSubject<number> = new BehaviorSubject<number>(null);
public mobileLongitude: BehaviorSubject<number> = new BehaviorSubject<number>(null);
public mobileAltitude: BehaviorSubject<number> = new BehaviorSubject<number>(null);
public mobileHeading: BehaviorSubject<number> = new BehaviorSubject<number>(null);
public mobileSpeed: BehaviorSubject<number> = new BehaviorSubject<number>(0);
public mobileDataTimestamp: BehaviorSubject<number> = new BehaviorSubject<number>(null);
And I change them in this way:
this.mobileSpeed.next(location.speed);
this.mobileLatitude.next(location.latitude);
this.mobileLongitude.next(location.longitude);
this.mobileAltitude.next(location.altitude);
this.mobileDataTimestamp.next(tmstp);
Now, is it sure that they are modified in the order I wrote them?
That is when I manage the last Behaviour (mobileDataTimestamp), are the previous Behaviours already updated?
this.mobileDataTimestamp.subscribe((value) => {
....
});
The alternative is to use an object Location into a BehaviorSubject.
But is it possible to use an object into a BehaviorSubject?
Thank you very much
cld