Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script src="https://unpkg.com/rxjs/bundles/Rx.min.js"></script>
  <input type="text">
  <div id="result"></div>
</body>
</html>
 
const Observable = Rx.Observable
const input = document.querySelector('input')
const search$ = Observable.fromEvent(input, 'input')
  .map(e => e.target.value)
  .filter(value => value.length >= 1)
  .distinctUntilChanged()
  .switchMap(() => wikiIt())
  .subscribe(
    x => renderSearchResult(x),
    err => console.error(err)
  )
function renderSearchResult (result) {
  document.querySelector('#result').innerHTML = result.username
}
function wikiIt () {
  return Observable.ajax('https://jsonplaceholder.typicode.com/users/1')
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
DrakeLeungpro
0viewers