README.rst 991 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Blinker
  2. =======
  3. Blinker provides a fast dispatching system that allows any number of
  4. interested parties to subscribe to events, or "signals".
  5. Signal receivers can subscribe to specific senders or receive signals
  6. sent by any sender.
  7. .. code-block:: pycon
  8. >>> from blinker import signal
  9. >>> started = signal('round-started')
  10. >>> def each(round):
  11. ... print "Round %s!" % round
  12. ...
  13. >>> started.connect(each)
  14. >>> def round_two(round):
  15. ... print "This is round two."
  16. ...
  17. >>> started.connect(round_two, sender=2)
  18. >>> for round in range(1, 4):
  19. ... started.send(round)
  20. ...
  21. Round 1!
  22. Round 2!
  23. This is round two.
  24. Round 3!
  25. Links
  26. -----
  27. - Documentation: https://blinker.readthedocs.io/
  28. - Changes: https://blinker.readthedocs.io/#changes
  29. - PyPI Releases: https://pypi.org/project/blinker/
  30. - Source Code: https://github.com/pallets-eco/blinker/
  31. - Issue Tracker: https://github.com/pallets-eco/blinker/issues/