'use strict' ; import type { XAxisOptions } from './Axis/AxisOptions' ; import type { ChartOptions } from './Chart/ChartOptions' ; import type { SeriesOptions } from './Series/SeriesOptions' ; import Axis from './Axis/Axis.js' ; import Chart from './Chart/Chart.js' ; import Series from './Series/Series.js' ; import U from './Utilities.js' ; const { addEvent , isFunction , objectEach , removeEvent } = U ; namespace Foundation { private export function registerEventOptions ( component , options ) { component . eventOptions = component . eventOptions || { } ; objectEach ( options . events , function ( event , eventType ) : void { if ( component . eventOptions [ eventType ] !== event ) { if ( component . eventOptions [ eventType ] ) { removeEvent ( component , eventType , component . eventOptions [ eventType ] ) ; delete component . eventOptions [ eventType ] ; } if ( isFunction ( event ) ) { component . eventOptions [ eventType ] = event ; addEvent ( component , eventType , event ) ; } } } ) ; } } export default Foundation ;