import { Report } from './report' ; export interface Storage < T = Report , S = void > { get : ( key : string ) => T | undefined ; set : ( key : string , value : T ) => S ; remove : ( key : string ) => T | undefined ; clear : ( ) => void ; } export class ReportStorageManager { storageKey : string ; private storage ? : Storage ; constructor ( storageKey , storage ? ) { this . storageKey = storageKey ; this . storage = storage ; } public get ( ) { if ( ! this . storage ) return ; return this . storage . get ( this . storageKey ) ; } public store ( report ) { if ( ! this . storage ) return ; this . storage . set ( this . storageKey , report ) ; } }