Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

425 B
Raw Blame
import { OBSERVER_PORT_NAME } from './constants';
import { openPort } from './open-port';
import type { PanelVoiceUpdate } from './types';

export function observeVoiceFromBackground(
  onVoiceUpdate: (update: PanelVoiceUpdate) => void,
  onConnect?: () => void,
): () => void {
  return openPort(
    OBSERVER_PORT_NAME,
    (msg) => {
      if (msg.type === 'VOICE_UPDATE') onVoiceUpdate(msg);
    },
    onConnect,
  );
}