We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c9c5ed commit 13c7026Copy full SHA for 13c7026
pydispatch/decorators.py
@@ -72,17 +72,14 @@ def receiver(
72
73
Receiving multiple events
74
75
- >>> @pydispatch.receiver(['foo', 'bar', 'baz'])
76
- ... def on_foobarbaz(value, **kwargs):
77
- ... print(f'on_foobarbaz: "{value}"')
78
-
79
- >>> pydispatch.emit('foo', 1)
80
- on_foo: "1"
81
- on_foobarbaz: "1"
82
83
- >>> pydispatch.emit('bar', 2)
84
- on_bar: "2"
85
- on_foobarbaz: "2"
+ >>> @pydispatch.receiver(['event_one', 'event_two'], auto_register=True)
+ ... def on_event_one_or_two(value, **kwargs):
+ ... print(value)
+
+ >>> pydispatch.emit('event_one', 1)
+ 1
+ >>> pydispatch.emit('event_two', 2)
+ 2
86
87
88
Arguments:
0 commit comments