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( name, function, 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.

Object 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

Static Properties

  • multi bool

    Whether the dict values should store a function, or a list of functions. This is a static property and should be changed only by subclassing funcStore.

    Initial value: False

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

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

History