HookHandle#
- class brainstate.HookHandle(manager_ref, hook, hook_type)[source]#
Handle for managing a registered hook.
This handle provides methods to enable, disable, and remove hooks without directly accessing the HookManager.
Examples
>>> state = bst.State(0, enable_hooks=True) >>> handle = state.register_hook('read', lambda ctx: print(ctx.value)) >>> handle.disable() >>> state.value # Hook not executed >>> handle.enable() >>> state.value # Hook executed >>> handle.remove() # Permanently unregister