
Enhances coroutine functionality by adding extensions missing in the core library, including `Dispatchers.IOorDefault` for consistent behavior across platforms lacking `Dispatchers.IO`.
Small library with extensions to Coroutines missing in coroutines-core.
implementation("net.codinux.kotlin:coroutine-extensions:1.0.1")
<dependency>
<groupId>net.codinux.web</groupId>
<artifactId>coroutine-extensions-jvm</artifactId>
<version>1.0.1</version>
</dependency>In Kotlin Multiplatform projects, you often want to use Dispatchers.IO in common code for tasks like network calls, which is not possible as JS has no Dispatchers.IO.
So I created Dispatchers.IOorDefault which runs on Dispatchers.IO on all platforms but JS and on Dispatchers.Default on JS and WASM.
suspend fun fetchFromNetwork() = withContext(Dispatchers.IOorDefault) {
// runs on Dispatchers.IO on all platforms but JS and WASM, for these runs on Dispatchers.Default
}Copyright 2025 codinux GmbH & Co.KG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Small library with extensions to Coroutines missing in coroutines-core.
implementation("net.codinux.kotlin:coroutine-extensions:1.0.1")
<dependency>
<groupId>net.codinux.web</groupId>
<artifactId>coroutine-extensions-jvm</artifactId>
<version>1.0.1</version>
</dependency>In Kotlin Multiplatform projects, you often want to use Dispatchers.IO in common code for tasks like network calls, which is not possible as JS has no Dispatchers.IO.
So I created Dispatchers.IOorDefault which runs on Dispatchers.IO on all platforms but JS and on Dispatchers.Default on JS and WASM.
suspend fun fetchFromNetwork() = withContext(Dispatchers.IOorDefault) {
// runs on Dispatchers.IO on all platforms but JS and WASM, for these runs on Dispatchers.Default
}Copyright 2025 codinux GmbH & Co.KG
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.