plastikaweb
1/3/2017 - 2:30 PM

JS Bin RxJS - Converting Arrays to Observable sequence // source https://jsbin.com/kadica

JS Bin

RxJS - Converting Arrays to Observable sequence

// source https://jsbin.com/kadica

<!DOCTYPE html>
<html>
<head>
<meta name="description" content="RxJS - Converting Arrays to Observable sequence">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js">
    </script>
</head>
<body>

<script id="jsbin-javascript">
'use strict';

var source = Rx.Observable.from([1, 2, 3, 4, 5]).map(function (val) {
  return val + 10;
});

source.subscribe(function (x) {
  return console.log('OnNext: ', x);
}, function (e) {
  return console.error(e);
}, function () {
  return console.log('completed');
});
</script>



<script id="jsbin-source-javascript" type="text/javascript">var source = Rx.Observable
              .from([1,2,3,4,5])
              .map(val => val + 10);

source.subscribe(
  x => console.log('OnNext: ', x),
  e => console.error(e),
  () => console.log('completed')
);</script></body>
</html>
'use strict';

var source = Rx.Observable.from([1, 2, 3, 4, 5]).map(function (val) {
  return val + 10;
});

source.subscribe(function (x) {
  return console.log('OnNext: ', x);
}, function (e) {
  return console.error(e);
}, function () {
  return console.log('completed');
});