From 3c65e6d6c50be6ecc176eca8c5390af2a2a146bb Mon Sep 17 00:00:00 2001 From: Alphons Joseph <93847055+Crazypersonalph@users.noreply.github.com> Date: Wed, 12 Mar 2025 20:11:26 +0800 Subject: [PATCH] dynamically import all plugins --- src/SEQTA.ts | 7 ++++++- src/plugins/hello.ts | 3 +++ src/plugins/index.ts | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/plugins/hello.ts diff --git a/src/SEQTA.ts b/src/SEQTA.ts index f9b422d9..7ffd0cc1 100644 --- a/src/SEQTA.ts +++ b/src/SEQTA.ts @@ -23,6 +23,8 @@ if (document.childNodes[1]) { import * as plugins from "@/plugins" // Import the plugins from folder + + async function init() { const hasSEQTATitle = document.title.includes("SEQTA Learn") @@ -42,7 +44,10 @@ async function init() { await initializeSettingsState() if (settingsState.onoff) { - plugins.Monofile() // Init plugins + Object.values(plugins).forEach(plugin => { + plugin(); + }) + } console.info( "[BetterSEQTA+] Successfully initalised BetterSEQTA+, starting to load assets.", diff --git a/src/plugins/hello.ts b/src/plugins/hello.ts new file mode 100644 index 00000000..6eade5c2 --- /dev/null +++ b/src/plugins/hello.ts @@ -0,0 +1,3 @@ +export async function init() { + console.log('Hello, world!') +} \ No newline at end of file diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 0ee859aa..6b498f25 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -1 +1,2 @@ -export { init as Monofile } from './monofile' \ No newline at end of file +export { init as Monofile } from './monofile' +export { init as Hello } from './hello' \ No newline at end of file