shiroyuki / Imagination

Java Beans-inspired Dependency Injection Framework for Python
https://imagination.readthedocs.io/en/latest/
4 stars 2 forks source link

Implement a event controller #8

Closed shiroyuki closed 6 years ago

shiroyuki commented 12 years ago

The event controller can dispatch an event and add event listeners to listen to events with the method specified below.

# imagination.event.controller
class Controller(object):
    def dispatch(self, kind): pass
    # dispatch an event of the specified kind.

    def bind(self, kind, handler): pass
    # bind a given handler to an event of the specified kind.

    def enable(self, kind=None): pass
    # enable listeners of an event of the specified kind or all events.

    def disable(self, kind=None): pass
    # disable listeners of an event of the specified kind or all events.

    def unbind(self, kind, handler=None): pass
    # unbind a given handler of an event of the specified kind or all events.