Reference 〉 Class
funcStore

Hooks( )

A dict-like container class for adding, storing, and removing hooks. This class can be interacted with through model.hooks where it is instantiated, but should not be instantiated by user code.

Methods

Click a method name for more detailed documentation.

  • add( place, func, prioritize )

    Inserts a function into designated places in the model's logic. See the Hooks Reference for a complete list of possible hooks and the function signatures necessary to use them.

    This method is aliased by the @model.hook function decorator, which is the preferred way to hook functions.

  • clear( )

    Clears all added data from the container.

  • remove( place, fname, removeall )

    Removes one or more previously registered hooks by the function name.

Properties

  • multi bool

    Indicates that the dict values should be a list of functions, and not single functions, so that multiple functions can be hooked to the same place.

    Initial value: True

Notes and Examples

  1. Contribute a Note

    Your email address will not be published.

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.

History