import { useContext } from 'preact/hooks' import { SeamlyEventBusContext } from 'ui/components/core/seamly-api-context' const useSeamlyEventBusContext = () => { const eventBus = useContext(SeamlyEventBusContext) if (!eventBus) { throw new Error( 'useSeamlyEventBusContext has to be used within ', ) } return eventBus } export default useSeamlyEventBusContext