mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
29 lines
595 B
Python
29 lines
595 B
Python
from typing import Awaitable, Callable, Optional, Protocol, TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from .events import Event
|
|
from .message import Message
|
|
|
|
Callback = Callable[[], None]
|
|
# IntervalID = int
|
|
|
|
|
|
class MessageTarget(Protocol):
|
|
async def post_message(
|
|
self,
|
|
message: "Message",
|
|
priority: Optional[int] = None,
|
|
) -> bool:
|
|
...
|
|
|
|
|
|
class EventTarget(Protocol):
|
|
async def post_message(
|
|
self,
|
|
message: "Message",
|
|
priority: Optional[int] = None,
|
|
) -> bool:
|
|
...
|
|
|
|
|
|
MessageHandler = Callable[["Message"], Awaitable] |