Class clove::Event

class clove::Event

An event. It can have some handlers (or: listeners) and can be triggered.

Read the Manual for details about the Clove event mechanism.

Public Functions

Event()
trigger(params)

Triggers the event.

This calls all registered handlers.

Parameters
  • params: Additional information about the event incidence.

addHandler(fct, owner)

Adds a handler (or: listener) to this event.

Whenever the event is triggered afterwards, the new handler is called.

Parameters
  • fct: A handler function.

  • owner: Optional owner widget. If given, removeHandler will be called automatically after widget removal.

hasHandlers()

Checks if this event has any handlers (otherwise triggering it doesn’t have an effect).

addHandlerOnce(fct, owner)

Like addHandler(), but automatically removes the handler after the event occurred once.

Parameters
  • fct: A handler function.

  • owner: Optional owner widget. If given, removeHandler will be called automatically after widget removal.

removeHandler(fct)

Removes a handler from this event.

Parameters
  • fct: The handler function to remove.