Skip to content

Commit 5eea817

Browse files
committed
Add unsafeSubscribe to RxScala
1 parent 24cecf3 commit 5eea817

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/Observable.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,22 @@ trait Observable[+T]
148148
thisJava.subscribe(subscriber.asJavaSubscriber)
149149
}
150150

151+
/**
152+
* Subscribe to Observable and invoke `OnSubscribe` function without any
153+
* contract protection, error handling, unsubscribe, or execution hooks.
154+
*
155+
* This should only be used for implementing an `Operator` that requires nested subscriptions.
156+
*
157+
* Normal use should use [[Observable.subscribe]] which ensures the Rx contract and other functionality.
158+
*
159+
* @param subscriber
160+
* @return [[Subscription]] which is the Subscriber passed in
161+
* @since 0.17
162+
*/
163+
def unsafeSubscribe(subscriber: Subscriber[T]): Subscription = {
164+
asJavaObservable.unsafeSubscribe(subscriber.asJavaSubscriber)
165+
}
166+
151167
/**
152168
* $subscribeSubscriberMain
153169
*

0 commit comments

Comments
 (0)