import type { Writable, Updater } from 'svelte/store'; import type { PluginHandle } from '../../../attach'; import type { InitSubscribe, Publisher } from '..'; import type { SubscribePluginHandle } from './factory'; /** * When we attach a subscriber, this is the structure into which we put its data */ export declare type PeerModel = { subscribe: () => Promise; stream?: MediaStream; meta: Writable<{ display: string; [key: string]: unknown; }>; codec?: { audio?: string; video?: string; }; ended?: true; }; /** * Peers get indexed by their ID */ export declare type Peers = Record; /** * Helper function for updating a store of Peers, inserting the given publishers into the store */ export declare function putPeers(initSub: InitSubscribe, publishers: Publisher[]): Updater; /** * Helper function for updating a store of Peers, marking a particular peer as 'ended' (which happens when that * publisher hangs up). * * In previous versions, we just deleted the publisher from the index, but this led to strange behaviour in svelte, * so instead we make the peer as ended, which can be used as a filter in the UI. */ export declare function markAsEnded(unpublished: number): Updater; /** * For a given peer, actually perform the subscription to that peer. */ export declare function mountSubscription(peer: PeerModel): Promise>; export * as Factory from './factory'; export { default as makeSubscribe } from './factory'; export { default as Peer } from './peer.svelte';