Created
May 14, 2016 07:19
-
-
Save ahgood/bbc2fbd592e721fd7ec7a4bd589d8733 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js"></script> | |
<script src="https://code.jquery.com/jquery-2.1.4.js"></script> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
'use strict'; | |
var reqStream = Rx.Observable.just('https://api.github.com/users'); | |
var respStream = reqStream.flatMap(function (url) { | |
return Rx.Observable.fromPromise(jQuery.getJSON(url)); | |
}); | |
respStream.subscribe(function (resp) { | |
console.log(resp); | |
}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var reqStream = Rx.Observable.just('https://api.github.com/users') | |
var respStream = reqStream.flatMap(url => Rx.Observable.fromPromise(jQuery.getJSON(url))) | |
respStream.subscribe(resp => {console.log(resp)})</script></body> | |
</html> | |
Raw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment