about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/PortableDevTools.razor
blob: ffd7082d87a0e4e02fd616d921f54dae493e597c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@if (Enabled) {
    <a href="/DevOptions">Portable devtools (enabled)</a>
    <div id="PortableDevTools" style="position: fixed; bottom: 0; right: 0; min-width: 200px; min-height: 100px; background: #0002;" draggable>
        <p>Cache size: @RuntimeCache.GenericResponseCache.Sum(x => x.Value.Cache.Count)</p>
    </div>
}
else {
    <a href="/DevOptions">Portable devtools (disabled)</a>
}

@code {
    private bool Enabled { get; set; } = LocalStorageWrapper.Settings.DeveloperSettings.EnablePortableDevtools;

    protected override async Task OnInitializedAsync() =>
    // if(!RuntimeCache.WasLoaded)
    // await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
    // StateHasChanged();
        Task.Run(async () => {
            while (true) {
                await Task.Delay(100);
                Enabled = LocalStorageWrapper.Settings.DeveloperSettings.EnablePortableDevtools;
                StateHasChanged();
            }
        });

}