penpal
Version:
A promise-based library for communicating with iframes via postMessage.
15 lines (14 loc) • 944 B
TypeScript
import { CallSender, WindowsInfo } from './types';
declare const _default: (callSender: CallSender, info: WindowsInfo, methodKeyPaths: string[], destroyConnection: Function, log: Function) => () => void;
/**
* Augments an object with methods that match those defined by the remote. When these methods are
* called, a "call" message will be sent to the remote, the remote's corresponding method will be
* executed, and the method's return value will be returned via a message.
* @param {Object} callSender Sender object that should be augmented with methods.
* @param {Object} info Information about the local and remote windows.
* @param {Array} methodKeyPaths Key paths of methods available to be called on the remote.
* @param {Promise} destructionPromise A promise resolved when destroy() is called on the penpal
* connection.
* @returns {Object} The call sender object with methods that may be called.
*/
export default _default;