-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
14 changed files
with
86 additions
and
52 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
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
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
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 |
---|---|---|
@@ -1,13 +1,10 @@ | ||
from .event import Event | ||
from .decorator import subscribe, subscribe_async, subscribe_process, subscribe_thread | ||
from .decorator import subscribe | ||
from .bus import EventBus, EventHandler | ||
|
||
__all__ = [ | ||
"Event", | ||
"EventBus", | ||
"EventHandler", | ||
"subscribe", | ||
"subscribe_async", | ||
"subscribe_process", | ||
"subscribe_thread", | ||
"subscribe" | ||
] |
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 |
---|---|---|
@@ -1,17 +1,22 @@ | ||
from typing import Callable, Coroutine, Any | ||
|
||
from .bus import EventBus | ||
from .event import E | ||
|
||
|
||
def subscribe(func): | ||
return EventBus.default.subscribe(func) | ||
class SubscribeDecorator: | ||
|
||
def __call__(self, func: Callable[[E], None]): | ||
return EventBus.default.subscribe(func) | ||
|
||
def subscribe_async(func): | ||
return EventBus.default.subscribe_async(func) | ||
def coro(self, func: Callable[[E], Coroutine[Any, Any, None]]): | ||
return EventBus.default.subscribe_async(func) | ||
|
||
def thread(self, func: Callable[[E], None]): | ||
return EventBus.default.subscribe_thread(func) | ||
|
||
def subscribe_thread(func): | ||
return EventBus.default.subscribe_thread(func) | ||
def process(self, func: Callable[[E], None]): | ||
return EventBus.default.subscribe_process(func) | ||
|
||
|
||
def subscribe_process(func): | ||
return EventBus.default.subscribe_process(func) | ||
subscribe = SubscribeDecorator() |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.3.2 | ||
0.3.3 |