import React from 'react'; import type { RemoteProxy, Methods, PenpalError } from 'penpal'; interface PenpalParentProps { /** * Function created by useState hook, i.e. * `const [child, setChild] = React.useState()` * This callback is used to allow returning the child asynchronously when a * connection is created, and destroying when the connection is broken */ setChild: React.Dispatch>; /** * Callback handler for when penpal throw errors */ onError?: (error: PenpalError) => void; /** * A mapping of your method names to their respective handler functions */ methods?: Methods; /** * The permissible origins to use to secure communication. Defaults to the current * origin. */ allowedOrigins?: (string | RegExp)[]; /** * The amount of time, in milliseconds, Penpal should wait * for the iframe to respond before rejecting the connection promise. */ timeout?: number; /** * An optional function to which debug logs are passed; Penpal provides * a simple `debug` function that logs messages to the console which can be * used if you don't want to write your own. */ log?: () => void; } type Subtract = A extends B ? never : A; type DeleteProp = { [K in Subtract]: O[K]; }; type OptionallyProps = { [K in keyof O]?: O[K]; }; type HTMLIframeProps = React.DetailedHTMLProps, HTMLIFrameElement>; type EditedHTMLIframeProps = OptionallyProps>; /** * The PenpalParent component invokes the iframe and defines the parent side * methods, as well as any attributes intended for the iframe tag. */ declare const PenpalParent: React.FC; export { PenpalParent }; export type { PenpalParentProps };