Skip to content
This repository was archived by the owner on Dec 6, 2019. It is now read-only.
/ async-under8 Public archive

Kotlin coroutine async implementation without java 8 requirement.

License

Notifications You must be signed in to change notification settings

fboldog/async-under8

Repository files navigation

DEPRECATED

update for 1.1 beta 17 on the way

async-under8

Library built upon Kotlin coroutines. Forked from kotlinx.coroutines (kotlinx-coroutines-async), but drops java 8 requirement.

This modification allows libraries to use asnyc and runs under most of Android devices.

Thanks to tikurahul - kotlin-futures implementation.

Example

import async_under8.async
import com.rahulrav.futures.Future
 
private fun startLongAsyncOperation(v: Int) =
        Future.submit {
            Thread.sleep(1000)
            "Result: $v"
        }
        
fun main(args: Array<String>) {
    
    val future = async<String> {
        (1..5).map {
            await(startLongAsyncOperation(it))
        }.joinToString("\n")
    }
    
    future.onSuccess {
        println(it)
    }
}

Status

Build Status

Download

Download

or depend via Gradle:

compile 'com.fboldog.async_under8:async_under8:0.0.1'

or Gradle Kotlin Script:

compile("com.fboldog.async_under8:async_under8:0.0.1")

or Maven:

<dependency>
  <groupId>com.fboldog.async_under8</groupId>
  <artifactId>async_under8</artifactId>
  <version>0.0.1</version>
</dependency>

About

Kotlin coroutine async implementation without java 8 requirement.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages