@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
80 lines (79 loc) • 3.48 kB
TypeScript
/**
* Module containing the set of APIs that support Teams-specific functionalities.
* @module
*/
import { LoadContext } from './interfaces';
/** Ready to unload function type */
export type readyToUnloadFunctionType = () => void;
/** Register on load handler function type */
export type registerOnLoadHandlerFunctionType = (context: LoadContext) => void;
/** Register before unload handler function type */
export type registerBeforeUnloadHandlerFunctionType = (readyToUnload: readyToUnloadFunctionType) => boolean;
/**
* Enable print capability to support printing page using Ctrl+P and cmd+P
*/
export declare function enablePrintCapability(): void;
/**
* default print handler
*/
export declare function print(): void;
/**
* Registers a handler to be called when the page has been requested to load.
*
* @remarks Check out [App Caching in Teams](https://learn.microsoft.com/microsoftteams/platform/tabs/how-to/app-caching)
* for a more detailed explanation about using this API.
*
* @param handler - The handler to invoke when the page is loaded.
*
* @beta
*/
export declare function registerOnLoadHandler(handler: registerOnLoadHandlerFunctionType): void;
/**
* @hidden
* Undocumented helper function with shared code between deprecated version and current version of the registerOnLoadHandler API.
*
* @internal
* Limited to Microsoft-internal use
*
* @param apiVersionTag - The tag indicating API version number with name
* @param handler - The handler to invoke when the page is loaded.
* @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
*
* @deprecated
*/
export declare function registerOnLoadHandlerHelper(apiVersionTag: string, handler: registerOnLoadHandlerFunctionType, versionSpecificHelper?: () => void): void;
/**
* Registers a handler to be called before the page is unloaded.
*
* @remarks Check out [App Caching in Teams](https://learn.microsoft.com/microsoftteams/platform/tabs/how-to/app-caching)
* for a more detailed explanation about using this API.
*
* @param handler - The handler to invoke before the page is unloaded. If this handler returns true the page should
* invoke the readyToUnload function provided to it once it's ready to be unloaded.
*
* @beta
*/
export declare function registerBeforeUnloadHandler(handler: registerBeforeUnloadHandlerFunctionType): void;
/**
* @hidden
* Undocumented helper function with shared code between deprecated version and current version of the registerBeforeUnloadHandler API.
*
* @internal
* Limited to Microsoft-internal use
*
* @param handler - - The handler to invoke before the page is unloaded. If this handler returns true the page should
* invoke the readyToUnload function provided to it once it's ready to be unloaded.
* @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
*
* @deprecated
*/
export declare function registerBeforeUnloadHandlerHelper(apiVersionTag: string, handler: registerBeforeUnloadHandlerFunctionType, versionSpecificHelper?: () => void): void;
/**
* Checks if teamsCore capability is supported by the host
*
* @returns boolean to represent whether the teamsCore capability is supported
*
* @throws Error if {@linkcode app.initialize} has not successfully completed
*
*/
export declare function isSupported(): boolean;