import { EventHandlers } from './EventHandlers' ; import { EventHandlerConnectors , EventHandlerUpdates } from './interfaces' ; export abstract class DerivedEventHandlers < P extends EventHandlers , O extends Record < string , any > = { } > extends EventHandlers < O > { derived : P ; unsubscribeParentHandlerListener : ( ) => void ; constructor ( derived , options ? ) { super ( options ) ; this . derived = derived ; this . options = options ; this . unsubscribeParentHandlerListener = this . derived . listen ( ( msg ) => { switch ( msg ) { case EventHandlerUpdates . HandlerEnabled : { return this . enable ( ) ; } case EventHandlerUpdates . HandlerDisabled : { return this . disable ( ) ; } default : { return ; } } } ) ; } inherit ( cb ) { return this . createProxyHandlers ( this . derived , cb ) ; } cleanup ( ) { super . cleanup ( ) ; this . unsubscribeParentHandlerListener ( ) ; } }