@@ -18,18 +18,24 @@ export type StorageSettingsType = {
18
18
maxLength : number ;
19
19
} ;
20
20
21
-
22
- export abstract class SessionBase < V extends string = StorageKeys > implements SessionManager < V > {
23
- abstract getSessionItem < T = unknown > ( itemKey : V | StorageKeys ) : Awaitable < T | unknown | null > ;
24
- abstract setSessionItem < T = unknown > ( itemKey : V | StorageKeys , itemValue : T ) : Awaitable < void > ;
21
+ export abstract class SessionBase < V extends string = StorageKeys >
22
+ implements SessionManager < V >
23
+ {
24
+ abstract getSessionItem < T = unknown > (
25
+ itemKey : V | StorageKeys ,
26
+ ) : Awaitable < T | unknown | null > ;
27
+ abstract setSessionItem < T = unknown > (
28
+ itemKey : V | StorageKeys ,
29
+ itemValue : T ,
30
+ ) : Awaitable < void > ;
25
31
abstract removeSessionItem ( itemKey : V | StorageKeys ) : Awaitable < void > ;
26
32
abstract destroySession ( ) : Awaitable < void > ;
27
-
33
+
28
34
async setItems ( items : Partial < Record < V , unknown > > ) : Promise < void > {
29
35
await Promise . all (
30
36
Object . entries ( items ) . map ( ( [ key , value ] ) => {
31
37
return this . setSessionItem ( key as V | StorageKeys , value ) ;
32
- } )
38
+ } ) ,
33
39
) ;
34
40
}
35
41
}
@@ -66,5 +72,5 @@ export interface SessionManager<V extends string = StorageKeys> {
66
72
*/
67
73
destroySession : ( ) => Awaitable < void > ;
68
74
69
- setItems ( items : Record < V , unknown > ) : void
75
+ setItems ( items : Record < V , unknown > ) : void ;
70
76
}
0 commit comments