Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 1.2 KB

readme.md

File metadata and controls

72 lines (51 loc) · 1.2 KB

Kyuso

Kyuso is a simple and flexible library for executing and scheduling tasks using Kotlin Coroutines or Java Executors

Installation

Gradle
repositories {
    maven(url = "https://maven.dimensional.fun/releases")
}

depenencies {
    implementation("fun.dimensional:kyuso:$VERSION")
}
Maven
<repository>
    <id>dimensional-maven-releases</id>
    <name>Dimensional Maven</name>
    <url>https://maven.dimensional.fun/releases</url>
</repository>
<dependency>
    <groupId>fun.dimensional</groupId>
    <artifactId>kyuso</artifactId>
    <version>%VERSION%</version>
</dependency>

Usage

Coroutine Backend

The coroutine backend uses Kotlin Coroutines to dispatch tasks.

val kyuso = Kyuso(Dispatchers.Default)
Executor Backend

The executor backend uses Java Executors to dispatch tasks.

val kyuso = Kyuso(Executors.newSingleThreadExecutor())

Example

kyuso.dispatch {
    println("hello")
}

// executes every 1 second with no initial delay
kyuso.dispatchEvery(1.seconds, null) {
println("Hello World")
}

delay(5.seconds)

Licensed under the Apache License • Read more here