Skip to content

Instantly share code, notes, and snippets.

@mayojava
Created October 9, 2018 18:27
Show Gist options
  • Save mayojava/c52e5af8803d4ca20161b1203d29e822 to your computer and use it in GitHub Desktop.
Save mayojava/c52e5af8803d4ca20161b1203d29e822 to your computer and use it in GitHub Desktop.
callback implementation to fetch user orders
fun showUserOrders(username: String, password: String) {
login(username, password) {
user -> fetchUserOrders(user.userId) {
orders -> showUserOrders(orders)
}
}
}
fun login(username: String, password: String, callback: (User) -> Unit)
fun fetchUserOrders(userId: Long, callback: (List<Orders>) -> Unit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment