import { ActionPayload } from '@ulangi/ulangi-action' ; import { Event } from '../interfaces/Event' ; import { EventListener } from '../types/EventListener' ; export function once < K extends keyof ActionPayload > ( actionType , callback ) { return ( event , unsubscribe ) : void => { if ( event . action . is ( actionType ) ) { unsubscribe ( ) ; callback ( event . action . payload ) ; } } ; }