diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-17 20:58:51 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-17 20:58:51 +0200 |
commit | ce7be6bbdf0edf069cb50aee64df187609893b92 (patch) | |
tree | cf9775e054a425243c5a7adeef6aa34344d3b49d /MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs | |
parent | Add changes (diff) | |
download | MatrixUtils-ce7be6bbdf0edf069cb50aee64df187609893b92.tar.xz |
Start refactor
Diffstat (limited to 'MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs')
-rw-r--r-- | MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs b/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs index 4e7117d..b7da78a 100644 --- a/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs +++ b/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs @@ -10,11 +10,13 @@ public class LocalStorageWrapper { //some basic logic public static async Task InitialiseRuntimeVariables(ILocalStorageService localStorage) { //RuntimeCache stuff - async void Save() => await SaveToLocalStorage(localStorage); - + async Task Save() => await SaveToLocalStorage(localStorage); + async Task SaveObject(string key, object obj) => await localStorage.SetItemAsync(key, obj); + async Task RemoveObject(string key) => await localStorage.RemoveItemAsync(key); + RuntimeCache.Save = Save; - RuntimeCache.SaveObject = async (key, obj) => await localStorage.SetItemAsync(key, obj); - RuntimeCache.RemoveObject = async key => await localStorage.RemoveItemAsync(key); + RuntimeCache.SaveObject = SaveObject; + RuntimeCache.RemoveObject = RemoveObject; if (RuntimeCache.LastUsedToken != null) { Console.WriteLine("Access token is not null, creating authenticated home server"); Console.WriteLine($"Homeserver cache: {RuntimeCache.HomeserverResolutionCache.Count} entries"); |