export interface LocalStorageService { getItem ( key ) : Promise < any > ; setItem ( key , value ) : Promise < void > ; } export class MemoryLocalStorageService implements LocalStorageService { items : { [ key ] : any ; } = { } ; async getItem ( key ) { return this . items [ key ] ; } async setItem ( key , value ) { this . items [ key ] = value ; } } export class BrowserLocalStorageService implements LocalStorageService { async getItem ( key ) { return localStorage . getItem ( key ) ; } async setItem ( key , value ) { localStorage . setItem ( key , value ) ; } }