diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b826566561..7ae0d1cccfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * **ALL DEPRECATIONS WERE REMOVED** * `Coroutines`: * New extension and function `doSynchronously` which are the same as `launchSynchronously` + * New extensions `doInDefault` and `doInIO` ## 0.4.36 diff --git a/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt b/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt index f938e53655f..ab23e3f87d7 100644 --- a/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt +++ b/coroutines/src/main/kotlin/dev/inmo/micro_utils/coroutines/DoInUI.kt @@ -8,3 +8,11 @@ suspend inline fun doInUI(noinline block: suspend CoroutineScope.() -> T) = Dispatchers.Main, block ) +suspend inline fun doInDefault(noinline block: suspend CoroutineScope.() -> T) = withContext( + Dispatchers.Default, + block +) +suspend inline fun doInIO(noinline block: suspend CoroutineScope.() -> T) = withContext( + Dispatchers.IO, + block +)