From e3b432aae63a025baf107f29eabbde00eca3c11e Mon Sep 17 00:00:00 2001 From: ChiaraBm Date: Fri, 20 Feb 2026 09:20:29 +0100 Subject: [PATCH] Removed unused startup interface. Added plugin list to frontend plugin initialization --- Moonlight.Frontend/MoonlightPlugin.cs | 7 +++++++ Moonlight.Frontend/Startup/IAppStartup.cs | 10 ---------- Moonlight.Frontend/StartupHandler.cs | 6 ++++++ 3 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 Moonlight.Frontend/Startup/IAppStartup.cs diff --git a/Moonlight.Frontend/MoonlightPlugin.cs b/Moonlight.Frontend/MoonlightPlugin.cs index c5ca0592..df5bbc75 100644 --- a/Moonlight.Frontend/MoonlightPlugin.cs +++ b/Moonlight.Frontend/MoonlightPlugin.cs @@ -5,6 +5,13 @@ namespace Moonlight.Frontend; public abstract class MoonlightPlugin : IPluginModule { + protected MoonlightPlugin[] Plugins { get; private set; } + + public void Initialize(MoonlightPlugin[] plugins) + { + Plugins = plugins; + } + public virtual void PreBuild(WebAssemblyHostBuilder builder){} public virtual void PostBuild(WebAssemblyHost application){} } \ No newline at end of file diff --git a/Moonlight.Frontend/Startup/IAppStartup.cs b/Moonlight.Frontend/Startup/IAppStartup.cs deleted file mode 100644 index f9e821eb..00000000 --- a/Moonlight.Frontend/Startup/IAppStartup.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using SimplePlugin.Abstractions; - -namespace Moonlight.Frontend.Startup; - -public interface IAppStartup : IPluginModule -{ - public void PreBuild(WebAssemblyHostBuilder builder); - public void PostBuild(WebAssemblyHost application); -} \ No newline at end of file diff --git a/Moonlight.Frontend/StartupHandler.cs b/Moonlight.Frontend/StartupHandler.cs index f8522516..2a7a0817 100644 --- a/Moonlight.Frontend/StartupHandler.cs +++ b/Moonlight.Frontend/StartupHandler.cs @@ -10,11 +10,17 @@ public static class StartupHandler var builder = WebAssemblyHostBuilder.CreateDefault(args); + // Setting up context + foreach (var plugin in plugins) + plugin.Initialize(plugins); + + // Stage 1: Pre Build foreach (var plugin in plugins) plugin.PreBuild(builder); var app = builder.Build(); + // Stage 2: Post Build foreach(var plugin in plugins) plugin.PostBuild(app);