@jitsi/js-utils
Version:
Utilities for Jitsi JS projects
49 lines (48 loc) • 1.31 kB
TypeScript
import { PostisOptions } from './postis';
import type { ITransportBackend } from './types';
/**
* Options for PostMessageITransportBackend.
*/
export interface IPostMessageTransportBackendOptions {
postisOptions?: Partial<PostisOptions>;
}
/**
* Implements message transport using the postMessage API.
*/
export default class PostMessageITransportBackend implements ITransportBackend {
/**
* The postis instance for communication.
*/
private postis;
/**
* Callback function for receiving messages.
*/
private _receiveCallback;
/**
* Creates new PostMessageITransportBackend instance.
*
* @param {Object} options - Optional parameters for configuration of the
* transport.
*/
constructor({ postisOptions }?: IPostMessageTransportBackendOptions);
/**
* Disposes the allocated resources.
*
* @returns {void}
*/
dispose(): void;
/**
* Sends the passed message.
*
* @param {Object} message - The message to be sent.
* @returns {void}
*/
send(message: any): void;
/**
* Sets the callback for receiving data.
*
* @param {Function} callback - The new callback.
* @returns {void}
*/
setReceiveCallback(callback: (message: any) => void): void;
}