I am just wondering what advantages there are using the one instead of the other.
@HostListener( 'window:resize' )
doSomething(): void {
// ...throttle with setTimeout and clearTimeout maybe...
}
and
fromEvent( window, 'resize' ).pipe(
// ... debounceTime, takeUntil etc.
).subscribe( () => {
doSomething();
})
Is it really just a question of context (e.g. easier handling the stream of events by using pipe() ), or is the observable more «mordern», or doesn't it matter at all?
Thanks!