/* track current and previous markers to identify by displaying info window */
const identifyPair$:Observable<number[]> = this.clicks$.pipe(
filter<ClickEvent>(event => event.event === "click"),
map(evt => evt.index),
debounceTime(200),
startWith(-1),
pairwise(),
share(),
);
identifyPair$.pipe(
filter(([previous, current]) => previous !== current),
map(([previous]) => previous),
selectIn(markerArray$),
filterTrue<Marker>(),
filter(marker => marker.isInfoWindowShown()),
).subscribe(marker => marker.hideInfoWindow());
identifyPair$.pipe(
map(([_, current]) => current),
selectIn(markerArray$),
filterTrue<Marker>(),
filter(marker => !marker.isInfoWindowShown()),
).subscribe(marker => marker.showInfoWindow());
eg, in the google-map component this:
could be separated into an external, testable service