import { PersistenceLayer , PersistenceLayerID } from '../PersistenceLayer' ; import { ListenablePersistenceLayer } from '../ListenablePersistenceLayer' ; import { AbstractAdvertisingPersistenceLayer } from './AbstractAdvertisingPersistenceLayer' ; import { PersistenceLayerEvent } from '../PersistenceLayerEvent' ; /**
 * A PersistenceLayer that allows the user to receive advertisements regarding
 * updates to the internal data.
 */ export class MockAdvertisingPersistenceLayer extends AbstractAdvertisingPersistenceLayer implements ListenablePersistenceLayer { public readonly id : PersistenceLayerID = 'mock' ; private readonly noDispatchEvent : boolean ; constructor ( persistenceLayer , noDispatchEvent = false ) { super ( persistenceLayer ) ; this . noDispatchEvent = noDispatchEvent ; } public async init ( ) { } public async stop ( ) { } public broadcastEvent ( event ) { if ( this . noDispatchEvent ) { return ; } this . dispatchEvent ( event ) ; } }