Last active
February 23, 2020 07:14
-
-
Save dimanem/c44f2cc71559afff3c4c5bc1ea54d551 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 <TResult> Task<TResult>.asObservable(): Observable<TResult> { | |
return Observable.create<TResult> { emitter -> | |
this.addOnSuccessListener { | |
emitter.onNext(it) | |
emitter.onComplete() | |
} | |
this.addOnFailureListener { | |
emitter.onError(it) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment