Guest User

Untitled

a guest
Jan 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. fun launch(f: () -> Unit) {
  2. GlobalScope.launch {
  3. f.invoke()
  4. }
  5. }
  6.  
  7. inline fun <reified T> asyncAndWait(crossinline f: () -> T) = runBlocking {
  8. return@runBlocking GlobalScope.async(Dispatchers.IO) {
  9. f.invoke()
  10. }.await()
  11. }
Add Comment
Please, Sign In to add comment