OpenQuizz
Une application de gestion des contenus pédagogiques
EventMixin Class Reference
Inheritance diagram for EventMixin:
Collaboration diagram for EventMixin:

Public Member Functions

def __init__ (self)
 
def add (self, event, subscriber, append=True)
 
def remove (self, event, subscriber)
 
def get_subscribers (self, event)
 
def publish (self, event, *args, **kwargs)
 

Detailed Description

A very simple publish/subscribe system.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)

Member Function Documentation

◆ add()

def add (   self,
  event,
  subscriber,
  append = True 
)
Add a subscriber for an event.

:param event: The name of an event.
:param subscriber: The subscriber to be added (and called when the
           event is published).
:param append: Whether to append or prepend the subscriber to an
       existing subscriber list for the event.

◆ get_subscribers()

def get_subscribers (   self,
  event 
)
Return an iterator for the subscribers for an event.
:param event: The event to return subscribers for.

◆ publish()

def publish (   self,
  event,
args,
**  kwargs 
)
Publish a event and return a list of values returned by its
subscribers.

:param event: The event to publish.
:param args: The positional arguments to pass to the event's
     subscribers.
:param kwargs: The keyword arguments to pass to the event's
       subscribers.

◆ remove()

def remove (   self,
  event,
  subscriber 
)
Remove a subscriber for an event.

:param event: The name of an event.
:param subscriber: The subscriber to be removed.

The documentation for this class was generated from the following file: