listenSuspend

inline fun <T : Event> listenSuspend(priority: EventPriority = EventPriority.NORMAL, ignoreCancelled: Boolean = false, once: Boolean = false, delay: Long = 0, debounce: Long = 0, throttle: Long = 0, noinline filter: (T) -> Boolean = { true }, noinline block: suspend (T) -> Unit): EventHandle

Registers a suspendable listener for the specified event type T.

This function is similar to listen but allows handling the event asynchronously using suspend functions.

Return

An EventHandle that can be used to unregister the event listener.

Parameters

priority

The priority at which the event is handled.

ignoreCancelled

Whether or not the event is ignored if it is cancelled.

once

If true, the listener will automatically unregister after it is triggered once.

delay

The delay in milliseconds before the event is handled.

debounce

The debounce time in milliseconds for event handling.

throttle

The throttle time in milliseconds to limit the frequency of event handling.

filter

A filter function to determine if the event should be handled.

block

The suspend function to execute when the event is triggered.