Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

645 B
Raw Blame
import type { IpcRenderer } from 'electron'
import { PRELOAD_BROWSER_EXTENSION_FRAME_LIFETIME_CHANNEL } from './browser-extension-api-surface'

export function installBrowserExtensionFrameLifetime(ipcRenderer: IpcRenderer): void {
  let retainedPort: MessagePort | undefined
  ipcRenderer.on(PRELOAD_BROWSER_EXTENSION_FRAME_LIFETIME_CHANNEL, (event) => {
    const [port, ...surplus] = event.ports
    for (const extra of surplus) {
      extra.close()
    }
    if (!port) {
      return
    }
    retainedPort?.close()
    // Retain the isolated-world endpoint until its document is destroyed or it is replaced.
    retainedPort = port
  })
}