redditwarp.util.event_dispatcher#

Provides a class to assist publisher classes in declaring events.

class redditwarp.util.event_dispatcher.EventDispatcher[source]#

Bases: Collection[T]

An event dispatcher.

This class doesn’t do any event dispatching on its own. You must subclass this class and implement it yourself, typically by implementing def __call__. See the example at the bottom of this module.

Handlers are registered in a set. Because of this, handlers cannot be registered multiple times, and the order in which they are fired is indeterminable.

attach(handler: T) None[source]#
detach(handler: T) None[source]#