From 2c40b1ebae53ebd8af4a375d8d3eb2bdb425c2dd Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sat, 13 Aug 2022 02:42:08 +0200 Subject: feat(plugins): event system --- src/util/plugin/Plugin.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/util/plugin/Plugin.ts') diff --git a/src/util/plugin/Plugin.ts b/src/util/plugin/Plugin.ts index 246e9931..96e05843 100644 --- a/src/util/plugin/Plugin.ts +++ b/src/util/plugin/Plugin.ts @@ -1,5 +1,13 @@ -export class Plugin { - onPluginLoaded() { - console.log('no onpluginloaded!') - } -} \ No newline at end of file +import EventEmitter from "events"; +import { TypedEventEmitter } from "@fosscord/util"; + +type PluginEvents = { + error: (error: Error | unknown) => void; + loaded: () => void; +}; + +export class Plugin extends (EventEmitter as new () => TypedEventEmitter) { + async init() { + // insert default config into database? + } +} -- cgit 1.5.1