diff options
| author | WerWolv <werwolv98@gmail.com> | 2022-04-12 21:15:31 +0200 |
|---|---|---|
| committer | WerWolv <werwolv98@gmail.com> | 2022-04-12 21:15:36 +0200 |
| commit | 012274b1a09f6959d41e9aa8bd69f5c30cc8f871 (patch) | |
| tree | dd6a2815d4a4a7b948bce5493c04aebb2cfdfb92 /plugin_loader/utilities.py | |
| parent | 070d11154f0ec761fba938a6f27b4a9111988412 (diff) | |
| download | decky-loader-012274b1a09f6959d41e9aa8bd69f5c30cc8f871.tar.gz decky-loader-012274b1a09f6959d41e9aa8bd69f5c30cc8f871.zip | |
Added library function to execute code in a different tab
Diffstat (limited to 'plugin_loader/utilities.py')
| -rw-r--r-- | plugin_loader/utilities.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/plugin_loader/utilities.py b/plugin_loader/utilities.py index a4abf5bc..a1785c15 100644 --- a/plugin_loader/utilities.py +++ b/plugin_loader/utilities.py @@ -1,4 +1,5 @@ from aiohttp import ClientSession +from injector import inject_to_tab class Utilities: def __init__(self, context) -> None: @@ -6,7 +7,8 @@ class Utilities: self.util_methods = { "ping": self.ping, "http_request": self.http_request, - "confirm_plugin_install": self.confirm_plugin_install + "confirm_plugin_install": self.confirm_plugin_install, + "execute_in_tab": self.execute_in_tab } async def confirm_plugin_install(self, request_id): @@ -22,4 +24,17 @@ class Utilities: } async def ping(self, **kwargs): - return "pong"
\ No newline at end of file + return "pong" + + async def execute_in_tab(self, tab, run_async, code): + try: + return { + "success": True, + "result" : await inject_to_tab(tab, code, run_async) + } + except Exception as e: + return { + "success": False, + "result": e + } + |
