public static BlazorContext Create(IJSRuntime js, ILoggerFactory loggerFactory) { var ctx = new BlazorContext(null) { RootPath = Directory.GetCurrentDirectory(), EnableImplicitAutoload = true, }; ctx.WorkingDirectory = ctx.RootPath; ctx.InitOutput(null); ctx.InitSuperglobals(); ctx._js = js; ctx._fileManager = new FileManager(ctx, loggerFactory); ctx._logger = loggerFactory.CreateLogger <BlazorContext>(); ctx.Output = BlazorWriter.CreateConsole(); ctx.CallJsVoid("window.php.init", ctx._objRef); // ctx.AutoloadFiles(); // return(ctx); }
/// <summary> /// Sets the context to redirect the script output into the console. /// </summary> public void StopRender() { Output.Flush(); Output.Dispose(); Output = BlazorWriter.CreateConsole(); }
/// <summary> /// Sets the context to redirect the script output into the builder. /// </summary> public void StartRender(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder builder) { Output = BlazorWriter.CreateTree(builder); }
protected BlazorContext(IServiceProvider services) : base(services) { Output = BlazorWriter.CreateConsole(); _objRef = DotNetObjectReference.Create <BlazorContext>(this); }