/// import { Deferred } from './promise'; import { EventEmitter } from 'events'; import { DataChannel } from '../data_channel'; /** * @module rtc.internal */ /** * Helper which handles DataChannel negotiation for RemotePeer * @class rtc.internal.ChannelCollection */ export declare class ChannelCollection extends EventEmitter { channels: Record>; defers: Record>; pending: Record; wait_d: Deferred; wait_p: Promise; local?: Record; remote?: Record; /** * A new data channel is available * @event data_channel_added * @param {String} name Name of the channel * @param {Promise -> rtc.Stream} stream Promise of the channel */ constructor(); /** * Set the local channel description. * @method setLocal * @param {Object} data Object describing each offered DataChannel */ setLocal(data: Record): void; /** * Set the remote channel description. * @method setRemote * @param {Object} data Object describing each offered DataChannel */ setRemote(data: Record): void; /** * Matches remote and local descriptions and creates promises common DataChannels * @method _update * @private */ _update(): void; /** * Resolves promises waiting for the given DataChannel * @method resolve * @param {DataChannel} channel The new channel */ resolve(channel: DataChannel): void; /** * Get a promise to a DataChannel. Will resolve if DataChannel was offered and gets initiated. Might reject after remote and local description are processed. * @method get * @param {String} name The label of the channel to get * @return {Promise -> DataChannel} Promise for the DataChannel */ get(name: string): Promise; }