File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1132,6 +1132,21 @@ trait Observable[+T]
1132
1132
toScalaObservable[T ](asJavaObservable.sample(duration.length, duration.unit, scheduler))
1133
1133
}
1134
1134
1135
+ /**
1136
+ * Return an Observable that emits the results of sampling the items emitted by the source Observable
1137
+ * whenever the specified sampler Observable emits an item or completes.
1138
+ *
1139
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/sample.o.png">
1140
+ *
1141
+ * @param sampler
1142
+ * the Observable to use for sampling the source Observable
1143
+ * @return an Observable that emits the results of sampling the items emitted by this Observable whenever
1144
+ * the sampler Observable emits an item or completes
1145
+ */
1146
+ def sample (sampler : Observable [Any ]): Observable [T ] = {
1147
+ toScalaObservable[T ](asJavaObservable.sample(sampler))
1148
+ }
1149
+
1135
1150
/**
1136
1151
* Returns an Observable that applies a function of your choosing to the first item emitted by a
1137
1152
* source Observable, then feeds the result of that function along with the second item emitted
You can’t perform that action at this time.
0 commit comments