import { ApolloPersistOptions } from './types' ; import CachePersistor from './CachePersistor' ; import Persistor , { PersistorConfig } from './Persistor' ; import Storage from './Storage' ; see SynchronousCachePersistor param options export const persistCacheSync = < T > ( options ) => { const cachePersistor = new SynchronousCachePersistor ( options ) ; cachePersistor . restoreSync ( ) ; } ; /**
 * Persistor engine that is going to use synchronous api
 */ export class SynchronousCachePersistor < T > extends CachePersistor < T > { persistor : SynchronousPersistor < T > ; constructor ( options ) { super ( options ) ; this . storage = new SynchronousStorage ( options ) ; this . persistor = new SynchronousPersistor ( { log : this . log , cache : this . cache , storage : this . storage } , options ) ; } restoreSync ( ) { this . persistor . restoreSync ( ) ; } } export class SynchronousPersistor < T > extends Persistor < T > { storage : SynchronousStorage < T > ; constructor ( { log , cache , storage } , options ) { super ( { log , cache , storage } , options ) ; } restoreSync ( ) { this . cache . restore ( this . storage . readSync ( ) ) ; } } export class SynchronousStorage < T > extends Storage < T > { constructor ( options ) { super ( options ) ; } readSync ( ) { return this . storage . getItem ( this . key ) ; } }