Created
October 18, 2020 12:04
-
-
Save chaxiu/6ce470e8100511dca57ddedf6c985b66 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
// delay(1000L) representing request to server | |
//Suspending Function | |
// ↓ | |
suspend fun getUserInfo(): String { | |
withContext(Dispatchers.IO) { | |
delay(1000L) | |
} | |
return "BoyCoder" | |
} | |
//Suspending Function | |
// ↓ | |
suspend fun getFriendList(user: String): String { | |
withContext(Dispatchers.IO) { | |
delay(1000L) | |
} | |
return "Tom, Jack" | |
} | |
//Suspending Function | |
// ↓ | |
suspend fun getFeedList(list: String): String { | |
withContext(Dispatchers.IO) { | |
delay(1000L) | |
} | |
return "{FeedList..}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment