extend

abstract fun <T : Extension> extend(extension: T): T(source)

Adds an extension to the host and returns the extension instance. The extension allows customization or extension of the host's functionality at various lifecycle stages such as setup, before draw, and after draw.

Return

The same extension instance that was added.

Parameters

extension

The extension instance to be added to the host.


abstract fun <T : Extension> extend(extension: T, configure: T.() -> Unit): T(source)

Adds an extension to the host and applies a configuration block to it. This method allows customization or extension of the host's functionality by invoking a user-defined configuration on the provided extension.

Return

The configured extension instance.

Parameters

extension

The extension instance to be added and configured.

configure

A lambda function defining the configuration to be applied to the extension.


abstract fun extend(stage: ExtensionStage = ExtensionStage.BEFORE_DRAW, userDraw: Program.() -> Unit)(source)

Adds an extension to the program that executes a user-defined block of code at a specified extension stage. The execution stage can be SETUP, BEFORE_DRAW, or AFTER_DRAW. This method prevents nesting of extend calls.

Parameters

stage

The stage in the program's lifecycle where the extension will be executed.

userDraw

The block of code to be executed as part of the extension.