import { Subject , Observable , timer , race } from 'rxjs' ; import { takeUntil } from 'rxjs/operators' ; import { Store } from 'vuex' ; import { XBus } from '../plugins/x-bus.types' ; import { RootXStoreState } from '../store/store.types' ; import { MaybeArray } from '../utils/types' ; import { XEvent } from './events.types' ; import { TimedWireOperatorOptions , TimeSelector } from './wiring.types' ; param events param on - The on function of the  XBus where the events will run.
 *  returns internal export function mergeEvents ( events , on ) { const subject = new Subject < void > ( ) ; const eventsList = Array . isArray ( events ) ? events : [ events ] ; eventsList . forEach ( raceEvent => on ( raceEvent ) . subscribe ( ( ) => subject . next ( ) ) ) ; return subject ; } param timeInMs param store returns internal export function normalizeTime ( timeInMs , store ) { return typeof timeInMs === 'function' ? timeInMs ( store ) : timeInMs ; } param durationInMs param options param on - The  XBus . on method.
 *  returns internal export function createTimer ( durationInMs , { cancelOn , forceOn } , on ) { let timerObservable = timer ( durationInMs ) ; if ( forceOn ) { timerObservable = race ( timerObservable , mergeEvents ( forceOn , on ) ) ; } if ( cancelOn ) { timerObservable = timerObservable . pipe ( takeUntil ( mergeEvents ( cancelOn , on ) ) ) ; } return timerObservable ; }