@@ -3592,6 +3592,28 @@ trait Observable[+T]
3592
3592
toScalaObservable[T ](asJavaObservable.doOnEach(Observer (onNext, onError,onCompleted)))
3593
3593
}
3594
3594
3595
+ /**
3596
+ * Modifies the source `Observable` so that it invokes the given action when it is subscribed from
3597
+ * its subscribers. Each subscription will result in an invocation of the given action except when the
3598
+ * source `Observable` is reference counted, in which case the source `Observable` will invoke
3599
+ * the given action for the first subscription.
3600
+ * <p>
3601
+ * <img width="640" height="390" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/doOnSubscribe.png" alt="">
3602
+ * <dl>
3603
+ * <dt><b>Scheduler:</b></dt>
3604
+ * <dd>`onSubscribe` does not operate by default on a particular `Scheduler`.</dd>
3605
+ * </dl>
3606
+ *
3607
+ * @param onSubscribe
3608
+ * the action that gets called when an observer subscribes to this `Observable`
3609
+ * @return the source `Observable` modified so as to call this Action when appropriate
3610
+ * @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#doonsubscribe">RxJava wiki: doOnSubscribe</a>
3611
+ * @since 0.20
3612
+ */
3613
+ def doOnSubscribe (onSubscribe : => Unit ): Observable [T ] = {
3614
+ toScalaObservable[T ](asJavaObservable.doOnSubscribe(() => onSubscribe))
3615
+ }
3616
+
3595
3617
/**
3596
3618
* Modifies an Observable so that it invokes an action when it calls `onCompleted` or `onError`.
3597
3619
* <p>
@@ -3609,20 +3631,22 @@ trait Observable[+T]
3609
3631
}
3610
3632
3611
3633
/**
3612
- * Modifies the source {@code Observable} so that it invokes the given action when it is unsubscribed from
3634
+ * Modifies the source ` Observable` so that it invokes the given action when it is unsubscribed from
3613
3635
* its subscribers. Each un-subscription will result in an invocation of the given action except when the
3614
- * source {@code Observable} is reference counted, in which case the source {@code Observable} will invoke
3636
+ * source ` Observable` is reference counted, in which case the source ` Observable` will invoke
3615
3637
* the given action for the very last un-subscription.
3616
3638
* <p>
3617
3639
* <img width="640" height="310" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/doOnUnsubscribe.png" alt="">
3618
3640
* <dl>
3619
- * <dt><b>Scheduler:</b></dt>
3620
- * <dd>{@code doOnUnsubscribe} does not operate by default on a particular {@link Scheduler} .</dd>
3641
+ * <dt><b>Scheduler:</b></dt>
3642
+ * <dd>` doOnUnsubscribe` does not operate by default on a particular ` Scheduler` .</dd>
3621
3643
* </dl>
3622
3644
*
3623
- * @param onUnsubscribe the action that gets called when this { @code Observable} is unsubscribed
3624
- * @return the source { @code Observable} modified so as to call this Action when appropriate
3645
+ * @param onUnsubscribe
3646
+ * the action that gets called when this `Observable` is unsubscribed
3647
+ * @return the source `Observable` modified so as to call this Action when appropriate
3625
3648
* @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#doonunsubscribe">RxJava wiki: doOnUnsubscribe</a>
3649
+ * @since 0.20
3626
3650
*/
3627
3651
def doOnUnsubscribe (onUnsubscribe : => Unit ): Observable [T ] = {
3628
3652
toScalaObservable[T ](asJavaObservable.doOnUnsubscribe(() => onUnsubscribe))
0 commit comments