Published
Edited
Aug 16, 2020
1 star
Insert cell
Insert cell
Insert cell
input1 = RXinput()
Insert cell
RXall(() =>
input1.value.pipe(
// wait for a 1000ms pause
op.debounceTime(1000),
// immediately provide a value without a need to wait for 'debounceTime'
op.startWith(""),
// if the value is the same, ignore
op.distinctUntilChanged()
)
)
Insert cell
Insert cell
combine1 = RXinput()
Insert cell
combine2 = RXinput()
Insert cell
RXall(() =>
// give me the last emitted value from each source, whenever either source emits
rx.combineLatest(combine1.value, combine2.value).pipe(
// wait for a pause of 1000ms before emitting a combined event
op.debounceTime(1000)
)
)
Insert cell
Insert cell
function RXinput() {
const form = html`<form>
<input name=input />
</form>`;

const obs = rx.Observable.create(subscriber => {
console.log('here');
const verb = "oninput";
form[verb] = e => {
console.log('oninput');
e && e.preventDefault();
subscriber.next(form.input.value);
};
form[verb]();
});

form.value = obs.pipe();

return form;
}
Insert cell
import { rx, op, RX, RXall, RXlatest } from '@mblsha/rxjs'
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more