UNPKG

1.12 kBTypeScriptView Raw
1/// <reference types="react" />
2/**
3 * ---
4 * category: utilities/react
5 * ---
6 * A decorator or higher order component that provides methods
7 * for cross-origin communication (between iframes/windows).
8 *
9 * see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
10 * @module windowMessageListener
11 * @param {Function} messageHandler a handler for messages receieved by the component
12 * @param {Function} validSource an optional function that would restrict message handling to a specified source.
13 * @returns {Function} a function that decorates a React component with the behavior
14 */
15declare const windowMessageListener: (...args: unknown[]) => (ComposedComponent: import("react").ComponentClass<any, any>) => any;
16/**
17 * Return the origin of the owner window of the DOM element
18 *
19 * see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
20 *
21 * @param {DOMElement} node
22 * @returns {String} the origin
23 */
24declare function origin(node: Element): string;
25export default windowMessageListener;
26export { origin, windowMessageListener };
27//# sourceMappingURL=windowMessageListener.d.ts.map
\No newline at end of file