mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-02 14:49:47 +00:00
fill changelog and add kdocs for firstOf
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
|
||||
## 28.0.0
|
||||
|
||||
* `Core`:
|
||||
* Add `firstOf` extension
|
||||
* `BehaviourBuilder`:
|
||||
* All builders for behaviours got boolean `useDefaultSubcontextInitialAction`
|
||||
* Add opportunity to pass `BehaviourContextData` in `DefaultBehaviourContext` constructor and `copy` method
|
||||
* By default, commands to other bots will be ignored in triggers and waiters
|
||||
|
||||
## 27.1.2
|
||||
|
||||
* `Core`:
|
||||
|
@@ -3,6 +3,18 @@ package dev.inmo.tgbotapi.utils
|
||||
import dev.inmo.micro_utils.coroutines.firstOf
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
||||
/**
|
||||
* Launches all provided suspending [deferreds] in this [CoroutineScope] and returns the value
|
||||
* produced by the first block that completes.
|
||||
*
|
||||
* - Provide at least one block; otherwise the call will never complete.
|
||||
* - Cancellation and error propagation semantics are delegated to the underlying
|
||||
* dev.inmo.micro_utils.coroutines.firstOf implementation.
|
||||
*
|
||||
* @param T The type of the resulting value.
|
||||
* @param deferreds The suspending blocks to race; they are started eagerly.
|
||||
* @return The result produced by the first completed block.
|
||||
*/
|
||||
suspend fun <T> CoroutineScope.firstOf(
|
||||
vararg deferreds: suspend () -> T
|
||||
): T = firstOf {
|
||||
|
Reference in New Issue
Block a user