@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
95 lines (94 loc) • 3.31 kB
TypeScript
/**
* @module
* @hidden
* @internal
* @beta
* Limited to Microsoft-internal use
*
* This capability contains the APIs for handling events that happen to other applications on the host
* *while* the developer's application is running. For example, if the developer wants to be notified
* when another application has been installed.
*/
import { AppId } from '../public/appId';
/**
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*
* Represent an event that has happened with other number of applications installed on this host.
* (e.g. a new app has been installed)
*/
export interface OtherAppStateChangeEvent {
/** An array of app ids that this event applies to */
appIds: string[];
}
/**
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*
* A function handler that will be called whenever an event happens with some number of applications installed on this host.
*/
export type OtherAppStateChangeEventHandler = (event: OtherAppStateChangeEvent) => void;
/**
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*
* This function allows an app to register a handler that will receive whenever other applications are installed
* on the host while the developer's application is running.
*
* @param appInstallHandler - This handler will be called whenever apps are installed on the host.
*
* @throws Error if {@link app.initialize} has not successfully completed, if the platform
* does not support the otherAppStateChange capability, or if a valid handler is not passed to the function.
*
* @example
* ``` ts
* if (otherAppStateChange.isSupported()) {
* otherAppStateChange.registerAppInstallationHandler((event: otherAppStateChange.OtherAppStateChangeEvent) => {
* // code to handle the event goes here
* });
* }
* ```
*/
export declare function registerAppInstallationHandler(appInstallHandler: OtherAppStateChangeEventHandler): void;
/**
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*
* This function can be called so that the handler passed to {@link registerAppInstallationHandler}
* will no longer receive app installation events. If this is called before registering a handler
* it will have no effect.
*
* @throws Error if {@link app.initialize} has not successfully completed or if the platform
* does not support the otherAppStateChange capability.
*/
export declare function unregisterAppInstallationHandler(): void;
/**
* @hidden
* @beta
* @internal
* Limited to Microsoft-internal use
*
* This function should be called by the Store App to notify the host that the
* app with the given appId has been installed.
*
* @throws Error if {@link app.initialize} has not successfully completed or if the platform
* does not support the otherAppStateChange capability.
*/
export declare function notifyInstallCompleted(appId: AppId): Promise<void>;
/**
* Checks if the otherAppStateChange capability is supported by the host
* @returns boolean to represent whether the otherAppStateChange capability is supported
*
* @throws Error if {@link app.initialize} has not successfully completed
*
* @beta
*/
export declare function isSupported(): boolean;