import { StorageAdapter } from './storage-adapter' ; import { CookieAdapter } from './cookie-adapter' ; export class SessionStorageAdapter implements StorageAdapter { getItem ( key ) { return sessionStorage . getItem ( key ) ; } setItem ( key , value ) { sessionStorage . setItem ( key , value ) ; } removeItem ( key ) { sessionStorage . removeItem ( key ) ; } clear ( ) { sessionStorage . clear ( ) ; } getSupported ( ) { if ( ! sessionStorage ) { return new CookieAdapter ( ) ; } try { sessionStorage . setItem ( 'ux-persistent-data-service' , 'ux-persistent-data-service' ) ; sessionStorage . removeItem ( 'ux-persistent-data-service' ) ; return this ; } catch ( err ) { return new CookieAdapter ( ) ; } } }