sample
signature: sample(sampler: Observable): Observable
sample(sampler: Observable): Observable
Sample from source when provided observable emits.
Examples
Example 1: Sample source every 2 seconds
( StackBlitz | jsBin | jsFiddle )
Example 2: Sample source when interval emits
( StackBlitz | jsBin | jsFiddle )
Example 3: Distinguish between drag and click
From Stack Overflow By Dorus
( StackBlitz | jsBin | jsFiddle )
Additional Resources
:newspaper: - Official docs
:file_folder: Source Code: https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/sample.ts
Last updated