interface YSANDYL { set: (key: string, value: string) => void; get: (key: string) => string | null; remove: (key: string) => void; clear: () => void; } // sessionStorage export const YS: YSANDYL = { set: (name: string, value: string): void => { if (typeof window !== 'undefined') { window.sessionStorage.setItem(name, value) } }, get: (name: string): string | null => { if (typeof window !== 'undefined') { return window.sessionStorage.getItem(name) } return null }, remove: (name: string): void => { if (typeof window !== 'undefined') { window.sessionStorage.removeItem(name) } }, clear: (): void => { if (typeof window !== 'undefined') { window.sessionStorage.clear(); } } } // locationStorage export const YL: YSANDYL = { set: (name: string, value: string): void => { if (typeof window !== 'undefined') { window.localStorage.setItem(name, value) } }, get: (name: string): string | null => { if (typeof window !== 'undefined') { return window.localStorage.getItem(name) } return null }, remove: (name: string): void => { if (typeof window !== 'undefined') { window.localStorage.removeItem(name) } }, clear: (): void => { if (typeof window !== 'undefined') { window.localStorage.clear(); } } }