Skip to content

Instantly share code, notes, and snippets.

@arun0009
Created March 24, 2019 01:50
Show Gist options
  • Save arun0009/6c89d71d9fbb3cb1af6a2270678316c8 to your computer and use it in GitHub Desktop.
Save arun0009/6c89d71d9fbb3cb1af6a2270678316c8 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/jutisat
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://unpkg.com/@reactivex/[email protected]/dist/global/Rx.js"></script>
<script id="jsbin-javascript">
"use strict";
var timer = Rx.Observable.timer(5000);
Rx.Observable.range(0, 200)
.map(function (n) { return n * 3; })
.repeat(timer)
.take(1000)
.subscribe(function (n) { return console.log("num: " + n); }, function (error) { return console.log(error); }, function () { return console.log("completed"); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNiaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJqc2Jpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBTSxLQUFLLEdBQUcsRUFBRSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7QUFFeEMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFLEdBQUcsQ0FBQztLQUViLEdBQUcsQ0FBQyxVQUFBLENBQUMsSUFBSSxPQUFBLENBQUMsR0FBRyxDQUFDLEVBQUwsQ0FBSyxDQUFDO0tBRWYsTUFBTSxDQUFDLEtBQUssQ0FBQztLQUViLElBQUksQ0FBQyxJQUFJLENBQUM7S0FDVixTQUFTLENBQ1AsVUFBQSxDQUFDLElBQUksT0FBQSxPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sR0FBRyxDQUFDLENBQUMsRUFBeEIsQ0FBd0IsRUFDN0IsVUFBQSxLQUFLLElBQUksT0FBQSxPQUFPLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxFQUFsQixDQUFrQixFQUMzQixjQUFNLE9BQUEsT0FBTyxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUMsRUFBeEIsQ0FBd0IsQ0FDL0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImNvbnN0IHRpbWVyID0gUnguT2JzZXJ2YWJsZS50aW1lcig1MDAwKTtcblxuUnguT2JzZXJ2YWJsZS5yYW5nZSgwLCAyMDApXG4gICAgICAgICAgICAgLy9tdWx0aXBseSBlYWNoIGlucHV0IHRpbWVzIDNcbiAgICAgICAgICAgICAubWFwKG4gPT4gbiAqIDMpXG4gICAgICAgICAgICAgLy90YWtlIHZhbHVlcyB1bnRpbCB0aW1lciBlbWl0c1xuICAgICAgICAgICAgIC5yZXBlYXQodGltZXIpXG4gICAgICAgICAgICAgLy90YWtlIGZpcnN0IDEwMDAgdmFsdWVzICAgXG4gICAgICAgICAgICAgLnRha2UoMTAwMClcbiAgICAgICAgICAgICAuc3Vic2NyaWJlKFxuICAgICAgICAgICAgICAgIG4gPT4gY29uc29sZS5sb2coXCJudW06IFwiICsgbiksXG4gICAgICAgICAgICAgICAgZXJyb3IgPT4gY29uc29sZS5sb2coZXJyb3IpLFxuICAgICAgICAgICAgICAgICgpID0+IGNvbnNvbGUubG9nKFwiY29tcGxldGVkXCIpXG4gICAgICAgICAgICAgICk7Il19
</script>
<script id="jsbin-source-javascript" type="text/javascript">const timer = Rx.Observable.timer(5000);
Rx.Observable.range(0, 200)
//multiply each input times 3
.map(n => n * 3)
//take values until timer emits
.repeat(timer)
//take first 1000 values
.take(1000)
.subscribe(
n => console.log("num: " + n),
error => console.log(error),
() => console.log("completed")
);</script></body>
</html>
"use strict";
var timer = Rx.Observable.timer(5000);
Rx.Observable.range(0, 200)
.map(function (n) { return n * 3; })
.repeat(timer)
.take(1000)
.subscribe(function (n) { return console.log("num: " + n); }, function (error) { return console.log(error); }, function () { return console.log("completed"); });
//# sourceMappingURL=data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AgICAgICAgLy90YWtlIGZpcnN0IDEwMDAgdmFsdWVzICAgXG4gICAgICAgICAgICAgLnRha2UoMTAwMClcbiAgICAgICAgICAgICAuc3Vic2NyaWJlKFxuICAgICAgICAgICAgICAgIG4gPT4gY29uc29sZS5sb2coXCJudW06IFwiICsgbiksXG4gICAgICAgICAgICAgICAgZXJyb3IgPT4gY29uc29sZS5sb2coZXJyb3IpLFxuICAgICAgICAgICAgICAgICgpID0+IGNvbnNvbGUubG9nKFwiY29tcGxldGVkXCIpXG4gICAgICAgICAgICAgICk7Il19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment