-
Notifications
You must be signed in to change notification settings - Fork 0
/
rxjs4ObservableConfig.js
55 lines (48 loc) · 1.5 KB
/
rxjs4ObservableConfig.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _symbolObservable = _interopRequireDefault(require("symbol-observable"));
var _rx = _interopRequireDefault(require("rx"));
var config = {
fromESObservable: function fromESObservable(observable) {
return _rx.default.Observable.create(function (observer) {
var _observable$subscribe = observable.subscribe({
next: function next(val) {
return observer.onNext(val);
},
error: function error(_error) {
return observer.onError(_error);
},
complete: function complete() {
return observer.onCompleted();
}
}),
unsubscribe = _observable$subscribe.unsubscribe;
return unsubscribe;
});
},
toESObservable: function toESObservable(rxObservable) {
var _ref;
return _ref = {
subscribe: function subscribe(observer) {
var subscription = rxObservable.subscribe(function (val) {
return observer.next(val);
}, function (error) {
return observer.error(error);
}, function () {
return observer.complete();
});
return {
unsubscribe: function unsubscribe() {
return subscription.dispose();
}
};
}
}, _ref[_symbolObservable.default] = function () {
return this;
}, _ref;
}
};
var _default = config;
exports.default = _default;