# Event Dispatcher

struct WpEventDispatcher

  The event dispatcher holds all the events and hooks and dispatches them. It orchestras the show on event stack.

WpEventDispatcher *wp_event_dispatcher_get_instance(WpCore *core)

  Returns the event dispatcher instance that is associated with the given core.

  This method will also create the instance and register it with the core, if it had not been created before.

  Parameters:

    - core -- the core

  Returns:

    (transfer full): the event dispatcher instance

void wp_event_dispatcher_push_event(WpEventDispatcher *self, WpEvent *event)

  Pushes a new event onto the event stack for dispatching only if there are any hooks are available for it.

  Parameters:

    - self -- the dispatcher

    - event -- (transfer full): the new event

void wp_event_dispatcher_register_hook(WpEventDispatcher *self, WpEventHook *hook)

  Registers an event hook.

  Parameters:

    - self -- the event dispatcher

    - hook -- (transfer none): the hook to register

void wp_event_dispatcher_unregister_hook(WpEventDispatcher *self, WpEventHook *hook)

  Unregisters an event hook.

  Parameters:

    - self -- the event dispatcher

    - hook -- (transfer none): the hook to unregister

WpIterator *wp_event_dispatcher_new_hooks_iterator(WpEventDispatcher *self)

  Returns an iterator to iterate over all the registered hooks.

  Deprecated:

    Use wp_event_dispatcher_new_hooks_for_event_type_iterator instead.

  Parameters:

    - self -- the event dispatcher

  Returns:

    (transfer full): a new iterator

WpIterator *wp_event_dispatcher_new_hooks_for_event_type_iterator(WpEventDispatcher *self, const gchar *event_type)

  Returns an iterator to iterate over the registered hooks for a particular event type.

  Since

    0.5.13

  Parameters:

    - self -- the event dispatcher

    - event_type -- the event type

  Returns:

    (transfer full): a new iterator