timeout

@CheckReturnValue
open fun timeout(timeout: Long, timeoutUnit: TimeUnit, handlerName: String, vararg data: Any?): T(source)

Sets the timeout on this component, invalidating the component on expiration, and running the timeout handler with the given name and its arguments.

Note: Components inside groups cannot have timeouts.

Timeout cancellation

The timeout will be canceled once a component has been deleted, including if the component was set to a single use.

Component deletion

  • If the component is a group, then all of its owned components will also be deleted.

  • If the component is inside a group, then all the group's components will also be deleted.

Timeout data

The data passed is transformed with toString, except snowflakes which get their IDs stored.

The data can only be reconstructed if a TimeoutParameterResolver exists for the handler's parameter type.

Remember the parameters need to be annotated with @TimeoutData.

Parameters

timeout

The value of the timeout

timeoutUnit

The unit of the timeout

handlerName

The name of the handler to run when the button is clicked, defined by either @ComponentTimeoutHandler or @GroupTimeoutHandler depending on the type

data

The data to pass to the component handler

See also

@ComponentTimeoutHandler

@GroupTimeoutHandler


@CheckReturnValue
open fun timeout(timeout: Duration, handlerName: String, vararg data: Any?): T(source)
abstract fun timeout(timeout: Duration, handlerName: String, vararg data: Any?): T(source)

Sets the timeout on this component, invalidating the component on expiration, and running the timeout handler with the given name and its arguments.

Note: Components inside groups cannot have timeouts.

Timeout cancellation

The timeout will be canceled once a component has been deleted, including if the component was set to a single use.

Component deletion

  • If the component is a group, then all of its owned components will also be deleted.

  • If the component is inside a group, then all the group's components will also be deleted.

Timeout data

The data passed is transformed with toString, except snowflakes which get their IDs stored.

The data can only be reconstructed if a TimeoutParameterResolver exists for the handler's parameter type.

Remember the parameters need to be annotated with @TimeoutData.

Parameters

timeout

The duration of the timeout

handlerName

The name of the handler to run when the button is clicked, defined by either @ComponentTimeoutHandler or @GroupTimeoutHandler depending on the type

data

The data to pass to the component handler

See also

@ComponentTimeoutHandler

@GroupTimeoutHandler