aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/me/bush/illnamethislater/Config.kt
diff options
context:
space:
mode:
authortherealbush <therealbush@users.noreply.github.com>2022-04-01 19:26:05 -1000
committertherealbush <therealbush@users.noreply.github.com>2022-04-01 19:26:05 -1000
commitf91739108759aea33b0442933ae064c783a1f89d (patch)
treec512908b3a7b7be62708b32c0e4dbd78d655f48d /src/main/kotlin/me/bush/illnamethislater/Config.kt
parent48b57ceb1680af6c426b6f928a403c958b1d3279 (diff)
downloadeventbus-kotlin-f91739108759aea33b0442933ae064c783a1f89d.tar.gz
eventbus-kotlin-f91739108759aea33b0442933ae064c783a1f89d.tar.bz2
eventbus-kotlin-f91739108759aea33b0442933ae064c783a1f89d.zip
almost done, just need to make thread safe, test, and document
Diffstat (limited to 'src/main/kotlin/me/bush/illnamethislater/Config.kt')
-rw-r--r--src/main/kotlin/me/bush/illnamethislater/Config.kt24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/main/kotlin/me/bush/illnamethislater/Config.kt b/src/main/kotlin/me/bush/illnamethislater/Config.kt
index eb9ccf5..ef946c5 100644
--- a/src/main/kotlin/me/bush/illnamethislater/Config.kt
+++ b/src/main/kotlin/me/bush/illnamethislater/Config.kt
@@ -1,7 +1,9 @@
package me.bush.illnamethislater
+import kotlinx.coroutines.Dispatchers
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
+import kotlin.coroutines.CoroutineContext
/**
@@ -15,15 +17,33 @@ import org.apache.logging.log4j.Logger
data class Config(
/**
- * The logger this [EventBus] will use to log errors, or [EventBus.debugInfo]
+ * The logger this [EventBus] will use to log errors, or log [EventBus.debugInfo]
*/
val logger: Logger = LogManager.getLogger("Eventbus"),
/**
+ * The [CoroutineContext] to use when posting events to parallel listeners. The default
+ * value will work just fine, but you can specify a custom context if desired.
+ *
+ * [What is a Coroutine Context?](https://kotlinlang.org/docs/coroutine-context-and-dispatchers.html)
+ *
+ * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething)
+ */
+ val parallelContext: CoroutineContext = Dispatchers.Default,
+
+ /**
* Whether this [EventBus] should try to find a "cancelled" field in events being listened for that
* are not a subclass of [Event]. This is experimental, and should be set to `false` if problems arise.
*
* [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething)
*/
- val thirdPartyCompatibility: Boolean = true
+ val thirdPartyCompatibility: Boolean = true,
+
+ /**
+ * Whether parallel listeners should be called before or after sequential listeners. Parallel listeners
+ * will always finish before sequential listeners are called, or before [EventBus.post] returns.
+ *
+ * [Information and examples](https://github.com/therealbush/eventbus-kotlin#tododothething)
+ */
+ val parallelFirst: Boolean = true
)