import { MatrixClient } from "./MatrixClient" ; /**
 * A MatrixClient class that handles events in sync for the /sync loop, instead
 * of trying to push its way through the /sync loop as fast as possible. It is
 * intended that the consumer extend this class and override the onWhatever()
 * functions it needs. All of the onWhatever() functions have a default behaviour
 * of doing nothing.
 */ export abstract class SynchronousMatrixClient extends MatrixClient { param { MatrixClient } baseClient protected constructor ( baseClient ) { super ( baseClient . homeserverUrl , baseClient . accessToken , baseClient . storageProvider ) ; } private async handleEvent ( emitType , arg1 , arg2 ) { if ( emitType === 'account_data' ) await this . onAccountData ( arg1 ) ; if ( emitType === 'room.account_data' ) await this . onRoomAccountData ( arg1 , arg2 ) ; if ( emitType === 'room.leave' ) await this . onRoomLeave ( arg1 , arg2 ) ; if ( emitType === 'room.invite' ) await this . onRoomInvite ( arg1 , arg2 ) ; if ( emitType === 'room.join' ) await this . onRoomJoin ( arg1 , arg2 ) ; if ( emitType === 'room.archived' ) await this . onRoomArchived ( arg1 , arg2 ) ; if ( emitType === 'room.upgraded' ) await this . onRoomUpgraded ( arg1 , arg2 ) ; if ( emitType === 'room.message' ) await this . onRoomMessage ( arg1 , arg2 ) ; if ( emitType === 'room.event' ) await this . onRoomEvent ( arg1 , arg2 ) ; this . emit ( emitType , arg1 , arg2 ) ; } protected startSyncInternal ( ) { return this . startSync ( this . handleEvent . bind ( this ) ) ; } param { any } event returns { Promise < any > } protected onAccountData ( event ) { return ; } param { string } roomId param { any } event returns { Promise < any > } protected onRoomAccountData ( roomId , event ) { return ; } param { string } roomId param { any } event returns { Promise < any > } protected onRoomLeave ( roomId , event ) { return ; } param { string } roomId param { any } event returns { Promise < any > } protected onRoomInvite ( roomId , event ) { return ; } param { string } roomId param { any } event returns { Promise < any > } protected onRoomJoin ( roomId , event ) { return ; } param { string } roomId param { any } event returns { Promise < any > } protected onRoomMessage ( roomId , event ) { return ; } param { string } roomId param { any } event returns { Promise < any > } protected onRoomArchived ( roomId , event ) { return ; } param { string } roomId param { any } event returns { Promise < any > } protected onRoomUpgraded ( roomId , event ) { return ; } param { string } roomId param { any } event returns { Promise < any > } protected onRoomEvent ( roomId , event ) { return ; } }