summaryrefslogtreecommitdiff
path: root/plugin_template.py
diff options
context:
space:
mode:
authortza <marios8543@gmail.com>2022-04-04 18:10:02 +0300
committertza <marios8543@gmail.com>2022-04-04 18:10:02 +0300
commit8c142c01bda31a164cf5bacf5a7ae85366334a61 (patch)
tree26d489ab5cdde58b1a003334f20af2dc783b617c /plugin_template.py
parentcbf46b950a6d1fcf659ca1fbac5e1857062bfbcd (diff)
downloaddecky-loader-8c142c01bda31a164cf5bacf5a7ae85366334a61.tar.gz
decky-loader-8c142c01bda31a164cf5bacf5a7ae85366334a61.zip
hot reloading, plugin instantiation, plugin main method
- The Loader now watches for file changes in the plugin directory, and will (re)import when a new plugin is created, or an existing one is modified. This is implemented by means of the watchdog library - Plugin classes are now instantiated (and therefore require a self arg in every method). This way they can maintain a state during the runtime of the loader (or until they are reloaded), and share data between methods. - Plugins can now have a __main() method, which can include long-running code. Every plugin's main method is ran in a separate asyncio task. - Plugin methods that start from __ are now uncallable from javascript. This can be helpful when implementing unfinished/development versions of methods.
Diffstat (limited to 'plugin_template.py')
-rw-r--r--plugin_template.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugin_template.py b/plugin_template.py
index be477d37..43088b14 100644
--- a/plugin_template.py
+++ b/plugin_template.py
@@ -7,8 +7,13 @@ class Plugin:
tile_view_html = ""
- async def method_1(**kwargs):
+ hot_reload = False
+
+ async def __main(self):
+ pass
+
+ async def method_1(self, **kwargs):
pass
- async def method_2(**kwargs):
+ async def method_2(self, **kwargs):
pass \ No newline at end of file