wishthis/node_modules/rxjs/dist/esm5/internal/operators/connect.js

17 lines
676 B
JavaScript
Raw Normal View History

2022-06-08 10:36:39 +00:00
import { Subject } from '../Subject';
2022-07-15 07:58:48 +00:00
import { innerFrom } from '../observable/innerFrom';
2022-06-08 10:36:39 +00:00
import { operate } from '../util/lift';
import { fromSubscribable } from '../observable/fromSubscribable';
var DEFAULT_CONFIG = {
connector: function () { return new Subject(); },
};
export function connect(selector, config) {
if (config === void 0) { config = DEFAULT_CONFIG; }
var connector = config.connector;
return operate(function (source, subscriber) {
var subject = connector();
2022-07-15 07:58:48 +00:00
innerFrom(selector(fromSubscribable(subject))).subscribe(subscriber);
2022-06-08 10:36:39 +00:00
subscriber.add(source.subscribe(subject));
});
}
//# sourceMappingURL=connect.js.map