UNPKG

@hypernetlabs/utils

Version:
35 lines 1.51 kB
import { ProxyError } from "@hypernetlabs/objects"; import { ResultAsync } from "neverthrow"; import Postmate from "postmate"; interface IIFrameCallData<CallDataType> { callId: number; data: CallDataType; } declare class IFrameCall<CallDataType, ResultType, ErrorType> { callData: IIFrameCallData<CallDataType>; protected promise: Promise<ResultType>; protected resolveFunc: ((result: ResultType) => void) | null; protected rejectFunc: ((error: ErrorType) => void) | null; constructor(callData: IIFrameCallData<CallDataType>); resolve(result: ResultType): void; reject(error: ErrorType): void; getResult(): ResultAsync<ResultType, ErrorType>; } export declare abstract class ParentProxy { protected element: HTMLElement | null; protected iframeUrl: string; protected iframeName: string; protected debug: boolean; protected handshake: Postmate; protected child: Postmate.ParentAPI | null; protected callId: number; protected calls: IFrameCall<any, any, any>[]; protected active: boolean; constructor(element: HTMLElement | null, iframeUrl: string, iframeName: string, debug?: boolean); protected activateResult: ResultAsync<void, ProxyError> | undefined; activate(): ResultAsync<void, ProxyError>; destroy(): void; protected _createCall<CallDataType, ErrorType, ResultType>(callName: string, data: CallDataType): ResultAsync<ResultType, ErrorType | ProxyError>; } export {}; //# sourceMappingURL=ParentProxy.d.ts.map