Last active
May 21, 2019 20:27
-
-
Save JacquesSmuts/9d1c10544e72c4d88e978ca65c5f07ff to your computer and use it in GitHub Desktop.
This file contains hidden or 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
suspend fun saveUsernameAndPassword(username: String, password: String) { | |
val result = suspendAsync(StorageService.getInstance()::saveUsernameAndPassword, username, password) | |
handleResult(result) | |
} | |
suspend fun <Input1, Input2, Output> suspendAsync(function: (Input1, Input2, (Output) -> Unit) -> Unit, | |
inputOne: Input1, inputTwo: Input2) = suspendCoroutine<Output> { continuation -> | |
function(inputOne, inputTwo) { output -> | |
continuation.resume(output) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment