A sampler() will hold incoming values, passing the latest one when it receives a signal on its .control:
/*!*/import { wrap, sampler, sink } from '@connectv/core';
import { fromEvent, interval } from 'rxjs';

let t = document.getElementById('t');
let p = document.getElementById('p');

/*!*/let s = sampler();

/*!*/wrap(fromEvent(document, 'click')).to(s.control); //--> sample on click

.to(sink(v => t.innerHTML = v))     //--> display the value of the timer
/*!*/.to(s)                              //--> send it to sampler
.subscribe(v => p.innerHTML = v);   //--> display sampled value

Further reading

Copied to Clipboard!