@@ -8,7 +8,7 @@ export interface PersistOptions {
88}
99
1010/** get stored item */
11- function getItem ( key : string , options ?: PersistOptions ) {
11+ const getItem = ( key : string , options ?: PersistOptions ) => {
1212 const cookie = document . cookie . split ( "; " ) . find ( c => c . startsWith ( key ) ) ;
1313 switch ( options ?. storage ) {
1414 case "cookie" :
@@ -18,10 +18,10 @@ function getItem(key: string, options?: PersistOptions) {
1818 default :
1919 return localStorage . getItem ( key ) ;
2020 }
21- }
21+ } ;
2222
2323/** set item to persistant store */
24- function setItem ( key : string , value : string , options ?: PersistOptions ) {
24+ const setItem = ( key : string , value : string , options ?: PersistOptions ) => {
2525 switch ( options ?. storage ) {
2626 case "cookie" :
2727 document . cookie = `${ key } =${ value } ; max-age=31536000; SameSite=Strict;` ;
@@ -33,13 +33,13 @@ function setItem(key: string, value: string, options?: PersistOptions) {
3333 default :
3434 localStorage . setItem ( key , value ) ;
3535 }
36- }
36+ } ;
3737/**
3838 * A plugin that persists and syncs RGS store between tabs.
3939 *
4040 * @returns A plugin that persists and syncs a value between tabs.
4141 */
42- export function persist < T > ( options ?: PersistOptions ) : Plugin < T > {
42+ export const persist = < T > ( options ?: PersistOptions ) : Plugin < T > = > {
4343 return {
4444 init ( key , _ , mutate ) {
4545 if ( typeof window === "undefined" ) return ;
@@ -62,4 +62,4 @@ export function persist<T>(options?: PersistOptions): Plugin<T> {
6262 }
6363 } ,
6464 } ;
65- }
65+ } ;
0 commit comments