From 925480dba41ecb7c010c933f16ffa2afcc50915b Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Thu, 30 Aug 2018 12:24:41 -0700 Subject: [PATCH] Adding details on the OfficeRuntime namespace which affects custom functions --- types/office-js/index.d.ts | 95 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 99d7ddac1b..0ed0eb0516 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -17200,6 +17200,101 @@ declare namespace OfficeExtension { //////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +////////////////////// Begin OfficeRuntime ///////////////////// +//////////////////////////////////////////////////////////////// + +declare namespace OfficeRuntime { + function displayWebDialog(url: string, options: DisplayWebDialogOptions): Promise; + const AsyncStorage: AsyncStorage; + + // tslint:disable-next-line:interface-name + interface AsyncStorage { + getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; + setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; + removeItem(key: string, callback?: (error?: Error) => void): Promise; + clear(callback?: (error?: Error) => void): Promise; + getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; + multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; + multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise; + multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; + } + + interface Dialog { + close(): Promise; + } + + // (copied from richapi/office-dialog/src/dialog.ts) + interface DisplayWebDialogOptions { + /** + * + * True if dialog opens in IFRAME + * + * [Api set: Dialog 1.2] + */ + displayInIFrame?: boolean; + /** + * + * The height of dialog as a percentage of window + * + * ex. '50%', '50' + * + * [Api set: Dialog 1.2] + */ + height?: string; + + /** + * + * The width of dialog as a percentage of window + * + * ex. '50%', '50' + * + * [Api set: Dialog 1.2] + */ + width?: string; + + /** + * + * True if title is hidden + * + * [Api set: Dialog 1.2] + */ + hideTitle?: boolean; + + /** + * + * Callback that is run when the dialog sends a message to its parent + * + * [Api set: Dialog 1.X] + */ + onMessage?: (message: string, dialog?: Dialog) => void; + + /** + * + * Callback that is run when the dialog is closed + * + * [Api set: Dialog 1.X] + */ + onClose?: () => void; + + /** + * + * Callback that is run when the dialog sends an error + * + * [Api set: Dialog 1.X] + */ + onRuntimeError?: (error: Error, dialog?: Dialog) => void; + } + } + + + +//////////////////////////////////////////////////////////////// +////////////////////// End OfficeRuntime ////////////////////// +//////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// ////////////////////// Begin OfficeCore ////////////////////////