Skip to main content

register_function

Method
This is a method of the HookRegistry class in the registry module.
Register a Python function as a hook.

Signature

def register_function(event: HookEvent, func: Callable[[HookInput], HookResult], matcher: Optional[str], name: Optional[str], description: Optional[str], sequential: bool, timeout: float, is_async: bool) -> str

Parameters

event
HookEvent
required
The event to hook
func
Callable
required
The function to call
matcher
Optional
Optional regex pattern to match targets
name
Optional
Optional name for the hook
description
Optional
Optional description
sequential
bool
default:"False"
Whether to run sequentially
timeout
float
default:"60.0"
Timeout in seconds
is_async
bool
default:"False"
Whether the function is async

Returns

Returns
str
The hook ID