Skip to content

Instantly share code, notes, and snippets.

@nathan-lapinski
Created November 13, 2018 13:07
Show Gist options
  • Save nathan-lapinski/dcab09af1708bb6481bc6614589fa76e to your computer and use it in GitHub Desktop.
Save nathan-lapinski/dcab09af1708bb6481bc6614589fa76e to your computer and use it in GitHub Desktop.
obs sub
subscribe(observerOrNext?: PartialObserver<T> | ((value: T) => void),
error?: (error: any) => void,
complete?: () => void): Subscription {
const { operator } = this;
const sink = toSubscriber(observerOrNext, error, complete);
if (operator) {
operator.call(sink, this.source);
} else {
sink.add(
this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
this._subscribe(sink) :
this._trySubscribe(sink)
);
}
if (config.useDeprecatedSynchronousErrorHandling) {
if (sink.syncErrorThrowable) {
sink.syncErrorThrowable = false;
if (sink.syncErrorThrown) {
throw sink.syncErrorValue;
}
}
}
return sink;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment