BACK
Referencesample
Reference · 96

sample

Takes source's latest value only on a notifier signal.

Signature

sample(notifier: ObservableInput): MonoTypeOperatorFunction

What it does

Holds source's latest value. When the notifier emits, it releases the stored value, if there is one.

When to use

Reading coordinates on a timer, taking the latest state on submit/click, pacing a stream by an external rhythm.

See also

sampleTime, withLatestFrom, audit

script.ts // TypeScript
CONSOLE · Console output
Hit Run to see the result...