|
@@ -1,9 +1,8 @@
|
|
|
import asyncio
|
|
|
from inspect import signature
|
|
|
-from justpy.htmlcomponents import HTMLBaseComponent
|
|
|
from pydantic import BaseModel
|
|
|
import traceback
|
|
|
-from typing import Any, Awaitable, Callable, List, Optional, Union
|
|
|
+from typing import Any, Awaitable, Callable, Dict, List, Optional, Union
|
|
|
|
|
|
from .elements.element import Element
|
|
|
|
|
@@ -11,6 +10,7 @@ class EventArguments(BaseModel):
|
|
|
class Config:
|
|
|
arbitrary_types_allowed = True
|
|
|
sender: Element
|
|
|
+ event: Dict
|
|
|
|
|
|
class ClickEventArguments(EventArguments):
|
|
|
pass
|
|
@@ -197,10 +197,7 @@ class KeyEventArguments(EventArguments):
|
|
|
modifiers: KeyboardModifiers
|
|
|
|
|
|
|
|
|
-def handle_event(handler: Optional[Union[Callable, Awaitable]],
|
|
|
- arguments: EventArguments,
|
|
|
- *,
|
|
|
- update: Optional[HTMLBaseComponent] = None):
|
|
|
+def handle_event(handler: Optional[Union[Callable, Awaitable]], arguments: EventArguments):
|
|
|
try:
|
|
|
if handler is None:
|
|
|
return
|
|
@@ -210,8 +207,6 @@ def handle_event(handler: Optional[Union[Callable, Awaitable]],
|
|
|
async def async_handler():
|
|
|
try:
|
|
|
await result
|
|
|
- if update is not None:
|
|
|
- await update.update()
|
|
|
except Exception:
|
|
|
traceback.print_exc()
|
|
|
asyncio.get_event_loop().create_task(async_handler())
|