Created
August 13, 2021 09:07
-
-
Save nayan-dhabarde/f1ae5899a48b0860e04246ae68408c3b to your computer and use it in GitHub Desktop.
Speak Coroutines with Deferred
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
class YourOldSyncLibrary { | |
val imageCompressor = ImageCompressor() | |
fun doSomethingSync(): Deferred<String> { | |
val | |
imageCompressor.compress(object: OnCompressListener { | |
override fun onCompress(filePath: String) { | |
} | |
override fun onError(exception: Exception) { | |
} | |
}) | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Deferred executes simultaneously with another deferred when you call await on both