Skip to content
This repository was archived by the owner on Dec 26, 2025. It is now read-only.

Commit fc2fda0

Browse files
authored
Merge pull request #42 from drma-dev/main
Add ContainKeyAsync
2 parents aacf993 + 86d3081 commit fc2fda0

3 files changed

Lines changed: 190 additions & 163 deletions

File tree

src/Blazored.SessionStorage/ISessionStorageService.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,21 @@ public interface ISessionStorageService
1111

1212
Task<string> KeyAsync(int index);
1313

14+
/// <summary>
15+
/// Checks if the key exists in Session Storage but does not check the value.
16+
/// </summary>
17+
/// <param name="key">name of the key</param>
18+
/// <returns>True if the key exist, false otherwise</returns>
19+
Task<bool> ContainKeyAsync(string key);
20+
1421
Task<int> LengthAsync();
1522

1623
Task RemoveItemAsync(string key);
1724

1825
Task SetItemAsync<T>(string key, T data);
1926

2027
event EventHandler<ChangingEventArgs> Changing;
28+
2129
event EventHandler<ChangedEventArgs> Changed;
2230
}
23-
}
31+
}

src/Blazored.SessionStorage/ISyncSessionStorageService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ public interface ISyncSessionStorageService
1010

1111
string Key(int index);
1212

13+
/// <summary>
14+
/// Checks if the key exists in Session Storage but does not check the value.
15+
/// </summary>
16+
/// <param name="key">name of the key</param>
17+
/// <returns>True if the key exist, false otherwise</returns>
18+
bool ContainKey(string key);
19+
1320
int Length();
1421

1522
void RemoveItem(string key);
1623

1724
void SetItem<T>(string key, T data);
1825

1926
event EventHandler<ChangingEventArgs> Changing;
27+
2028
event EventHandler<ChangedEventArgs> Changed;
2129
}
2230
}

0 commit comments

Comments
 (0)