__init__.py 762 B

1234567891011121314151617181920212223242526272829303132
  1. # -*- coding: utf-8 -*-
  2. """
  3. pyee supplies a `EventEmitter` class that is similar to the
  4. `EventEmitter` class from Node.js. In addition, it supplies the subclasses
  5. `AsyncIOEventEmitter`, `TwistedEventEmitter` and `ExecutorEventEmitter`
  6. for supporting async and threaded execution with asyncio, twisted, and
  7. concurrent.futures Executors respectively, as supported by the environment.
  8. # Example
  9. ```text
  10. In [1]: from pyee.base import EventEmitter
  11. In [2]: ee = EventEmitter()
  12. In [3]: @ee.on('event')
  13. ...: def event_handler():
  14. ...: print('BANG BANG')
  15. ...:
  16. In [4]: ee.emit('event')
  17. BANG BANG
  18. In [5]:
  19. ```
  20. """
  21. from pyee.base import EventEmitter, Handler, PyeeError, PyeeException
  22. __all__ = ["EventEmitter", "Handler", "PyeeError", "PyeeException"]