Skip to content

Commit

Permalink
📃added default args to clear session storage helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejpurves committed Nov 22, 2023
1 parent 44e3e88 commit 7615fec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-pigs-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'thebe-core': patch
---

Added default arguments to clear sesion storage utility functions
4 changes: 2 additions & 2 deletions packages/core/src/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export async function getExistingServer(
*
* @param storagePrefix
*/
export function clearAllSavedSessions(storagePrefix: string) {
export function clearAllSavedSessions(storagePrefix: string = 'thebe-binder') {
const keysToRemove: string[] = [];
for (let i = 0; i < window.localStorage.length; i++) {
const key = window.localStorage.key(i);
Expand All @@ -117,7 +117,7 @@ export function clearAllSavedSessions(storagePrefix: string) {
* @param storagePrefix
* @param url
*/
export function clearSavedSession(storagePrefix: string, url: string) {
export function clearSavedSession(storagePrefix: string = 'thebe-binder', url: string = '') {
console.debug(`thebe:clearSavedSession - removing ${makeStorageKey(storagePrefix, url)}`);
window.localStorage.removeItem(makeStorageKey(storagePrefix, url));
}

0 comments on commit 7615fec

Please sign in to comment.