doInDefault and doInIO

This commit is contained in:
InsanusMokrassar 2021-05-10 19:24:21 +06:00
parent e9223d5502
commit df4eaea4b9
2 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,7 @@
* **ALL DEPRECATIONS WERE REMOVED** * **ALL DEPRECATIONS WERE REMOVED**
* `Coroutines`: * `Coroutines`:
* New extension and function `doSynchronously` which are the same as `launchSynchronously` * New extension and function `doSynchronously` which are the same as `launchSynchronously`
* New extensions `doInDefault` and `doInIO`
## 0.4.36 ## 0.4.36

View File

@ -8,3 +8,11 @@ suspend inline fun <T> doInUI(noinline block: suspend CoroutineScope.() -> T) =
Dispatchers.Main, Dispatchers.Main,
block block
) )
suspend inline fun <T> doInDefault(noinline block: suspend CoroutineScope.() -> T) = withContext(
Dispatchers.Default,
block
)
suspend inline fun <T> doInIO(noinline block: suspend CoroutineScope.() -> T) = withContext(
Dispatchers.IO,
block
)