import { useEffect } from 'react' ; import { useSimulatorEventBus } from '../simulator-event-bus' ; import { SimulatorEventTypes } from '../simulator-event-bus-types' ; import { ActiveStep } from './state/types' ; export const useActiveStep = ( onChange ) => { const { on , off } = useSimulatorEventBus ( ) ; useEffect ( ( ) => { on ( SimulatorEventTypes . ACTIVE_STEP_CHANGED , onChange ) ; return ( ) => { off ( SimulatorEventTypes . ACTIVE_STEP_CHANGED , onChange ) ; } ; } , [ on , off , onChange ] ) ; } ;