summaryrefslogtreecommitdiff
path: root/frontend/src/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/index.tsx')
-rw-r--r--frontend/src/index.tsx25
1 files changed, 25 insertions, 0 deletions
diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx
new file mode 100644
index 00000000..89194777
--- /dev/null
+++ b/frontend/src/index.tsx
@@ -0,0 +1,25 @@
+import PluginLoader from './plugin-loader';
+
+declare global {
+ interface Window {
+ DeckyPluginLoader: PluginLoader;
+ importDeckyPlugin: Function;
+ syncDeckyPlugins: Function;
+ }
+}
+
+window.DeckyPluginLoader?.dismountAll();
+
+window.DeckyPluginLoader = new PluginLoader();
+window.importDeckyPlugin = function (name: string) {
+ window.DeckyPluginLoader?.importPlugin(name);
+};
+
+window.syncDeckyPlugins = async function () {
+ const plugins = await (await fetch('http://127.0.0.1:1337/plugins')).json();
+ for (const plugin of plugins) {
+ window.DeckyPluginLoader?.importPlugin(plugin);
+ }
+};
+
+setTimeout(() => window.syncDeckyPlugins(), 5000);