Skip to content

Commit 25ce82f

Browse files
Added Observable.create.
(a) it will stop the pointless discussions around it. (b) it is removes the interference with from(T*) (c) we should remove the latter, since that is not the common case.
1 parent 99a1d03 commit 25ce82f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,14 @@ object Observable {
18941894
}))
18951895
}
18961896

1897+
def create[T](func: Observer[T] => Subscription): Observable[T] = {
1898+
Observable[T](rx.Observable.create(new OnSubscribeFunc[T] {
1899+
def onSubscribe(t1: rx.Observer[_ >: T]): rx.Subscription = {
1900+
func(Observer(t1))
1901+
}
1902+
}))
1903+
}
1904+
18971905
/**
18981906
* Returns an Observable that invokes an [[rx.lang.scala.Observer]]'s [[rx.lang.scala.Observer.onError onError]] method when the Observer subscribes to it
18991907
*

0 commit comments

Comments
 (0)