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);