import { Observable , of , Subject } from 'rxjs' ; import { StorageStrategy } from '../lib/core/interfaces/storageStrategy' ; export const StorageStrategyStubName = 'stub_strategy' ; export class StorageStrategyStub implements StorageStrategy < any > { readonly keyChanges : Subject < string > = new Subject ( ) ; public store : any = { } ; public _available : boolean = true ; readonly name : string ; constructor ( name ? ) { this . name = name || StorageStrategyStubName ; } get isAvailable ( ) : boolean { return this . _available ; } get ( key ) { return of ( this . store [ key ] ) ; } set ( key , value ) { this . store [ key ] = value ; this . keyChanges . next ( key ) ; return of ( value ) ; } del ( key ) { delete this . store [ key ] ; this . keyChanges . next ( key ) ; return of ( null ) ; } clear ( ) { this . store = { } ; this . keyChanges . next ( null ) ; return of ( null ) ; } }