Created
July 8, 2019 03:20
-
-
Save nhphong/c4370c21e06c4d3f0193de31cdb55336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T> Observable<T>.debounceIf( | |
predicate: (T) -> Boolean, | |
timeout: Long, | |
unit: TimeUnit, | |
scheduler: Scheduler | |
): Observable<T> { | |
return Observable.merge( | |
this.filter { predicate(it) }, | |
this.filter { !predicate(it) } | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment