@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
42 lines (41 loc) • 1.62 kB
TypeScript
/**
* Subcapability that allows communication between the dialog and the parent app.
*
* @remarks
* Note that dialog can be invoked from parentless scenarios e.g. Search Message Extensions. The subcapability `parentCommunication` is not supported in such scenarios.
*
* @module
*/
import { PostMessageChannel } from '../dialog';
/**
* Send message to the parent from dialog
*
* @remarks
* This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
*
* @param message - The message to send to the parent
*/
export declare function sendMessageToParentFromDialog(message: any): void;
/**
* Send message to the dialog from the parent
*
* @param message - The message to send
*/
export declare function sendMessageToDialog(message: any): void;
/**
* Register a listener that will be triggered when a message is received from the app that opened the dialog.
*
* @remarks
* This function is only intended to be called from code running within the dialog. Calling it from outside the dialog will have no effect.
*
* @param listener - The listener that will be triggered.
*/
export declare function registerOnMessageFromParent(listener: PostMessageChannel): void;
/**
* Checks if dialog.url.parentCommunication capability is supported by the host
*
* @returns boolean to represent whether dialog.url.parentCommunication capability is supported
*
* @throws Error if {@linkcode app.initialize} has not successfully completed
*/
export declare function isSupported(): boolean;