i have 2 observables, hover$
, unhover$
, triggered on hover , on blur respectively.
the unhover$
has debouncetime(500)
delay being fast.
now consider timeline:
[ 0ms] hover triggered [ 50ms] unhover 500ms debounce started [ 100ms] hover triggered [ 550ms] unhover triggered
how can 'cancel' first unhover$
pending, when new value emitted hover$
sequence?
you can use takeuntil
have observable unsubscribed if notifier observable emits value.
something this:
unhover$ .debouncetime(500) .switchmap(evt => rx.observable.of(evt) .takeuntil(hover$) ) .subscribe(console.log);
Comments
Post a Comment