-
-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34e9d24
commit f4432a4
Showing
5 changed files
with
47 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import Any, Callable, Optional, Sequence, Union | ||
|
||
from .. import context | ||
|
||
|
||
def on(type: str, # pylint: disable=redefined-builtin | ||
handler: Optional[Callable[..., Any]] = None, | ||
args: Union[None, Sequence[str], Sequence[Optional[Sequence[str]]]] = None, *, | ||
throttle: float = 0.0, | ||
leading_events: bool = True, | ||
trailing_events: bool = True, | ||
): | ||
"""Subscribe to a global event. | ||
:param type: name of the event | ||
:param handler: callback that is called upon occurrence of the event | ||
:param args: arguments included in the event message sent to the event handler (default: `None` meaning all) | ||
:param throttle: minimum time (in seconds) between event occurrences (default: 0.0) | ||
:param leading_events: whether to trigger the event handler immediately upon the first event occurrence (default: `True`) | ||
:param trailing_events: whether to trigger the event handler after the last event occurrence (default: `True`) | ||
""" | ||
context.get_client().layout.on(type, handler, args, | ||
throttle=throttle, leading_events=leading_events, trailing_events=trailing_events) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters