in src/managers/epic-manager.ts [65:95]
private createSubscription(index: number) {
const epic = this.options.epics[index];
const observable = epic(this.options.actions, this.options.state, this.options.services);
if (!observable) {
const name = getFunctionName(epic);
throw new TypeError(
`combineEpics: one of the provided Epics "${name}" does not return a stream. Double check you\'re not missing a return statement!`,
);
}
const subscriber = new Subscriber(
value => {
this.options.subscriber.next(value);
},
err => {
this.options.onError(err, index);
},
() => {
subscriber.unsubscribe();
// If we haven't finished adding subscriptions, this is a synchronous
// completion. We don't need to do anything... yet.
if (this.subscriptions.length === this.options.epics.length) {
this.checkForCompletion();
}
},
);
this.subscriptions[index] = { state: State.Active, subscription: subscriber };
observable.subscribe(subscriber);
}