@inject IJSRuntime jsRuntime;

@inject IBuildOrderService buildOrderService

@implements IDisposable

<FormLayoutComponent>
    <FormTextAreaComponent Label="JSON Data"
                           Rows="14"
                           Value="@buildOrderService.AsJson()">
    </FormTextAreaComponent>
</FormLayoutComponent>

@code {

    protected override void OnInitialized()
    {
        buildOrderService.Subscribe(StateHasChanged);
    }

    void IDisposable.Dispose()
    {
        buildOrderService.Unsubscribe(StateHasChanged);
    }

    protected override bool ShouldRender()
    {
#if DEBUG
        jsRuntime.InvokeVoidAsync("console.time", "BuildOrderComponent");
#endif

        return true;
    }

    protected override void OnAfterRender(bool firstRender)
    {
#if DEBUG
        jsRuntime.InvokeVoidAsync("console.timeEnd", "BuildOrderComponent");
#endif
    }

}