2022-06-08 10:36:39 +00:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.connect = void 0;
|
|
|
|
var Subject_1 = require("../Subject");
|
2022-07-15 07:58:48 +00:00
|
|
|
var innerFrom_1 = require("../observable/innerFrom");
|
2022-06-08 10:36:39 +00:00
|
|
|
var lift_1 = require("../util/lift");
|
|
|
|
var fromSubscribable_1 = require("../observable/fromSubscribable");
|
|
|
|
var DEFAULT_CONFIG = {
|
|
|
|
connector: function () { return new Subject_1.Subject(); },
|
|
|
|
};
|
|
|
|
function connect(selector, config) {
|
|
|
|
if (config === void 0) { config = DEFAULT_CONFIG; }
|
|
|
|
var connector = config.connector;
|
|
|
|
return lift_1.operate(function (source, subscriber) {
|
|
|
|
var subject = connector();
|
2022-07-15 07:58:48 +00:00
|
|
|
innerFrom_1.innerFrom(selector(fromSubscribable_1.fromSubscribable(subject))).subscribe(subscriber);
|
2022-06-08 10:36:39 +00:00
|
|
|
subscriber.add(source.subscribe(subject));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
exports.connect = connect;
|
|
|
|
//# sourceMappingURL=connect.js.map
|