UNPKG

post-me

Version:

Use web Workers and other Windows through a simple Promise API

26 lines (25 loc) 1.17 kB
import { MethodsType } from './common'; import { Messenger } from './messenger'; import { Connection } from './connection'; /** * Initiate the handshake from the Parent side * * @param messenger - The Messenger used to send and receive messages from the other end * @param localMethods - The methods that will be exposed to the other end * @param maxAttempts - The maximum number of handshake attempts * @param attemptsInterval - The interval between handshake attempts * @returns A Promise to an active {@link Connection} to the other end * * @public */ export declare function ParentHandshake<M0 extends MethodsType>(messenger: Messenger, localMethods?: M0, maxAttempts?: number, attemptsInterval?: number): Promise<Connection>; /** * Initiate the handshake from the Child side * * @param messenger - The Messenger used to send and receive messages from the other end * @param localMethods - The methods that will be exposed to the other end * @returns A Promise to an active {@link Connection} to the other end * * @public */ export declare function ChildHandshake<M extends MethodsType>(messenger: Messenger, localMethods?: M): Promise<Connection>;