Skip to content

Instantly share code, notes, and snippets.

@JacquesSmuts
Last active May 26, 2019 19:12
Show Gist options
  • Save JacquesSmuts/d099eff5e66aa6b1d5de924f87c9e967 to your computer and use it in GitHub Desktop.
Save JacquesSmuts/d099eff5e66aa6b1d5de924f87c9e967 to your computer and use it in GitHub Desktop.
fun saveUsername(username: String) {
val result = StorageService.getInstance()::saveUsername suspendAndInvokeWith username
handleResult(result)
}
private suspend infix fun <Input, Output> ((Input, (Output) -> Unit) -> Unit).suspendAndInvokeWith(input: Input): Output {
return suspendAsync(this, input)
}
@dazza5000
Copy link

should line 3 be the following?

val result = StorageService.getInstance()::saveUsername suspendAndInvokeWith username

@JacquesSmuts
Copy link
Author

val result = StorageService.getInstance()::saveUsername suspendAndInvokeWith username

Good catch, thank you. I've updated it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment