UNPKG

electron-window-rtc

Version:

Exchange media streams between Electron windows with WebRTC.

51 lines (50 loc) 1.53 kB
import { BrowserWindow } from 'electron'; export interface RegisteredWindow { name: string; window: BrowserWindow; } declare class _WindowRTCMain { /** * Singleton instance. */ private static instance; /** * An `Array` of registered `BrowserWindow` with unique names. */ readonly registeredWindows: RegisteredWindow[]; constructor(); /** * Dispose the singleton. */ dispose(): void; /** * Register a `BrowserWindow` for message forwarding. * * @param { string } name The name the window will be registered with. * @param { BrowserWindow } window The window. */ register(name: string, window: BrowserWindow): void; /** * Unregister a `BrowserWindow` by its name. * * @param { string } name The name the window has been registered with. */ unregister(name: string): void; /** * Callback for `WindowRTCIpcChannel.GetOwnName` * @returns { Promise<string>} The name of the requesting window. */ private getOwnNameCallback; /** * Callback for `WindowRTCIpcChannel.GetWindows` * @returns { Promise<string[]>} The registered windows names. */ private getWindowsCallback; /** * Callback for `WindowRTCIpcChannel.Signal` * @returns { Promise<undefined | Error>} An `Error` if signaling message couldn't be forwarded (window was not found). */ private signalCallback; } declare const singleton: _WindowRTCMain; export { singleton as WindowRTCMain };