EventProvider

事件提供者。

用于安装在 Application 中,通过 EventProviderFactory 向其提供一个 事件处理器, 使其能够向目标事件处理器提供(推送)事件。

事件提供者无所谓形式,可以是一个 BotManager, 或是一个定时任务、一个http服务, 或者其他任何什么。

See also

Functions

Link copied to clipboard
abstract suspend fun cancel(reason: Throwable? = null): Boolean

关闭操作.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun delay(duration: JavaDuration, runnable: Runnable): DelayableCompletableFuture<Void?>

延时 duration 时间后执行回调函数 runnable,得到一个 DelayableCompletableFuture

open fun delay(millis: Long, runnable: Runnable): DelayableCompletableFuture<Void?>

延迟 millis 毫秒后执行 runnable,得到一个 DelayableCompletableFuture

open fun delay(time: Long, timeUnit: TimeUnit, runnable: Runnable): DelayableCompletableFuture<Void?>

延迟时间单位为 timeUnittime 时长后执行 runnable,得到一个 DelayableCompletableFuture

Link copied to clipboard

延迟 duration 时间后,执行 supplier, 并将 supplier 得到结果通过得到的 DelayableCompletableFuture 向下传递。

open fun <V> delayAndCompute(millis: Long, supplier: Supplier<V>): DelayableCompletableFuture<V>

延迟 millis 毫秒的时长后执行 supplier, 并将 supplier 得到结果通过得到的 DelayableCompletableFuture 向下传递。

open fun <V> delayAndCompute(time: Long, timeUnit: TimeUnit, supplier: Supplier<V>): DelayableCompletableFuture<V>

延迟时间单位为 timeUnittime 时长后执行 supplier, 并将 supplier 得到结果通过得到的 DelayableCompletableFuture 向下传递。

Link copied to clipboard
abstract fun invokeOnCompletion(handler: CompletionHandler)

当完成(或被cancel)时执行一段处理。

Link copied to clipboard
abstract suspend fun join()

挂起, 直到当前实例被 cancel 或完成.

Link copied to clipboard
abstract suspend fun start(): Boolean

启动操作.

Link copied to clipboard
open fun waiting()

阻塞当前线程并等待 join 的挂起结束。

Properties

Link copied to clipboard
Link copied to clipboard
abstract val isActive: Boolean

是否正在运行,即启动后尚未关闭。

Link copied to clipboard
abstract val isCancelled: Boolean

是否已经被取消。

Link copied to clipboard
abstract val isStarted: Boolean

是否已经启动过了。

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun <A : Application> CoroutineScope.applicationLauncher(create: suspend () -> A): ApplicationLauncher<A>

通过一个协程作用域并提供构建函数来得到一个 ApplicationLauncher 实例。

Link copied to clipboard
inline fun <T> CoroutineScope.effectedFlowItems(crossinline block: suspend FlowCollector<T>.() -> Unit): Items<T>

以构建 Flow 的方式构建 Items.

Link copied to clipboard
inline fun <T> CoroutineScope.effectedItemsByFlow(crossinline flowFactory: () -> Flow<T>): Items<T>

提供 CoroutineScope 和构建 Flow 的函数 flowFactory 来构建 Items.

Link copied to clipboard
inline fun <T> CoroutineScope.flowItems(crossinline block: suspend FlowCollector<T>.(Items.PreprocessingProperties) -> Unit): Items<T>

以构建 Flow 的方式构建 Items.

Link copied to clipboard
inline fun <T> CoroutineScope.itemsByFlow(crossinline flowFactory: (Items.PreprocessingProperties) -> Flow<T>): Items<T>

提供 CoroutineScope 和构建 Flow 的函数 flowFactory 来构建 Items.

Link copied to clipboard
fun <T> CoroutineScope.lazyValue(init: Boolean = false, initializer: suspend () -> T): LazyValue<T>
Link copied to clipboard
inline fun <T> CoroutineScope.produceItems(context: CoroutineContext = EmptyCoroutineContext, capacity: Int = 0, crossinline block: suspend ProducerScope<T>.(Items.PreprocessingProperties) -> Unit): Items<T>

通过 produce 构建 ChannelIterator 来得到一个 Items 实例。