Simple Input Observable

Creating Observable from the input event on a <input> field

by Mario_Rivis

HTML

<script src="https://unpkg.com/@reactivex/[email protected]/dist/global/Rx.js"></script>

<input id="my-input">

JavaScript

const myInput = document.getElementById('my-input');
  
Rx.Observable.fromEvent(myInput, 'input')
    .debounceTime(300)
    .subscribe(event => console.log(event.target.value));