/**
 * Event container subscription type
 */ export type EventContainerSubscription < EventArgType > = ( arg : EventArgType ) => void ; /**
 * Event container for event subscriptions.
 */ export class EventContainer < EventArgType = undefined > { private readonly subscriptions : EventContainerSubscription < EventArgType > [ ] = [ ] ; param subscription subscribe ( subscription ) { const index = this . getIndex ( subscription ) ; if ( index === - 1 ) this . subscriptions . push ( subscription ) ; } param subscription unsubscribe ( subscription ) { const index = this . getIndex ( subscription ) ; if ( index >= 0 ) this . subscriptions . splice ( index , 1 ) ; } /**
     * Fire an event.
     */ fire ( arg ) { for ( const subscription of this . subscriptions ) subscription ( arg ) ; } private getIndex ( subscription ) { return this . subscriptions . indexOf ( subscription ) ; } }