import { FactoryProvider } from '@angular/core' ; import { AsyncStorage , StorageStrategy , StrategyIndex } from 'ngx-webstorage' ; import { CrossStorageStrategy } from '../strategies/cross-storage' ; export class CrossStorageService extends AsyncStorage { constructor ( strategy ) { super ( strategy ) ; } } export function buildService ( index ) { const strategy = index . indexStrategy ( CrossStorageStrategy . strategyName ) ; return new CrossStorageService ( strategy ) ; } export const CrossStorageServiceProvider = { provide : CrossStorageService , useFactory : buildService , deps : [ StrategyIndex ] , } ;