@putkoff/abstract-utilities 0.1.173 → 0.1.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,11 +11,7 @@ export declare function getSafeLocalStorage(): Storage | undefined;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function callStorage<K extends keyof Storage>(method: K, ...args: Parameters<Storage[K]>): ReturnType<Storage[K]> | undefined;
|
|
13
13
|
/**
|
|
14
|
-
* Safely call localStorage
|
|
15
|
-
*
|
|
16
|
-
* @param storageName "localStorage" or "sessionStorage"
|
|
17
|
-
* @param method one of the Storage methods, e.g. "getItem", "setItem", etc.
|
|
18
|
-
* @param args arguments to pass along (e.g. key, value)
|
|
19
|
-
* @returns whatever the underlying method returns, or undefined if unavailable/fails
|
|
14
|
+
* Safely call storage methods (`localStorage` or `sessionStorage`) without blowing up.
|
|
15
|
+
* Returns `undefined` on any error.
|
|
20
16
|
*/
|
|
21
|
-
export declare function safeStorage<S extends "localStorage" | "sessionStorage",
|
|
17
|
+
export declare function safeStorage<S extends "localStorage" | "sessionStorage", K extends keyof Storage>(storageName: S, method: K, ...args: Parameters<Storage[K]>): ReturnType<Storage[K]> | undefined;
|