made with esnextbin
Created
April 15, 2016 19:37
-
-
Save trxcllnt/774d9171a34dafaf07ce121f17bcbbfe to your computer and use it in GitHub Desktop.
esnextbin sketch
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> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
</body> | |
</html> |
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
import { Observable, ReplaySubject } from 'rxjs/Rx'; | |
Observable | |
.fromPromise(new Promise((res) => res(true))) | |
.map(() => 'abc') | |
.do(() => console.log('LOG_1')) | |
.multicast(() => new ReplaySubject()) | |
.refCount() | |
.do(() => console.log('LOG_2')) | |
.flatMap(() => Observable.timer(500) | |
.flatMap(() => Observable.throw('ERR'))) | |
.retry(3) | |
.subscribe(() => {}) |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"babel-runtime": "6.6.1", | |
"rxjs": "5.0.0-beta.6" | |
} | |
} |
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
'use strict'; | |
var _promise = require('babel-runtime/core-js/promise'); | |
var _promise2 = _interopRequireDefault(_promise); | |
var _Rx = require('rxjs/Rx'); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
_Rx.Observable.fromPromise(new _promise2.default(function (res) { | |
return res(true); | |
})).map(function () { | |
return 'abc'; | |
}).do(function () { | |
return console.log('LOG_1'); | |
}).multicast(function () { | |
return new _Rx.ReplaySubject(); | |
}).refCount().do(function () { | |
return console.log('LOG_2'); | |
}).flatMap(function () { | |
return _Rx.Observable.timer(500).flatMap(function () { | |
return _Rx.Observable.throw('ERR'); | |
}); | |
}).retry(3).subscribe(function () {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment