Hook

Annotation to mark a static method as a OpMode lifecycle hook, which will be executed at the desired phase of any OpMode lifecycle, via the BunyipsLib listener.

Methods marked with this annotation must have exactly zero method parameters, and must be static, or they will not be executed.

Method visibility does not impact the ability for this method to be run. These methods are executed even if a BunyipsOpMode is not running.

To access the current OpMode from these hooks, see getOpMode.

Do note the Hook will not execute on System OpModes or BunyipsLib-integrated OpModes (such as HardwareTester). You can bypass this by passing in a boolean flag ignoreOpModeType, but should be used with caution.

Author

Lucas Bubner, 2024

Since

7.0.0

Types

Link copied to clipboard
enum Target
The times at which this method can be executed in the OpMode lifecycle.

Functions

Link copied to clipboard
abstract fun ignoreOpModeType(): Boolean
Setting this flag to true will cause this hook to also execute for System and BunyipsLib-integrated OpModes.
Link copied to clipboard
abstract fun on(): Hook.Target
Link copied to clipboard
abstract fun priority(): Int

Inherited functions

Link copied to clipboard
abstract fun annotationType(): Class<out Annotation>
Link copied to clipboard
abstract fun equals(p: Any): Boolean
Link copied to clipboard
abstract fun hashCode(): Int
Link copied to clipboard
abstract fun toString(): String