/ utils / commandLifecycle.ts
commandLifecycle.ts
 1  type CommandLifecycleState = 'started' | 'completed'
 2  
 3  type CommandLifecycleListener = (
 4    uuid: string,
 5    state: CommandLifecycleState,
 6  ) => void
 7  
 8  let listener: CommandLifecycleListener | null = null
 9  
10  export function setCommandLifecycleListener(
11    cb: CommandLifecycleListener | null,
12  ): void {
13    listener = cb
14  }
15  
16  export function notifyCommandLifecycle(
17    uuid: string,
18    state: CommandLifecycleState,
19  ): void {
20    listener?.(uuid, state)
21  }