attempt to add plugin events to the plugin frontend api.

unable to test right now though
This commit is contained in:
Party Wumpus
2024-04-09 15:44:38 +01:00
committed by PartyWumpus
parent de9d2144a6
commit f9ff518e6d
6 changed files with 57 additions and 21 deletions
@@ -14,7 +14,7 @@ from ..localplatform.localplatform import setgid, setuid, get_username, get_home
from ..enums import UserType
from .. import helpers
from typing import List, TypeVar, Type
from typing import List, TypeVar, Any
DataType = TypeVar("DataType")
@@ -83,11 +83,11 @@ class SandboxedPlugin:
sysmodules[key.replace("decky_loader.", "")] = sysmodules[key]
from .imports import decky
async def emit(event: str, data: DataType | None = None, data_type: Type[DataType] | None = None) -> None:
async def emit(event: str, *args: Any) -> None:
await self._socket.write_single_line_server(dumps({
"type": SocketMessageType.EVENT,
"event": event,
"data": data
"args": args
}))
# copy the docstring over so we don't have to duplicate it
emit.__doc__ = decky.emit.__doc__