diff --git a/types/custom-functions-runtime/custom-functions-runtime-tests.ts b/types/custom-functions-runtime/custom-functions-runtime-tests.ts index c35c172d7c..86eecbedda 100644 --- a/types/custom-functions-runtime/custom-functions-runtime-tests.ts +++ b/types/custom-functions-runtime/custom-functions-runtime-tests.ts @@ -1,11 +1,10 @@ -/* Note that this is a sample function for the purpose of running the below CustomFunctionsMappings test */ -function ADD10(n: number) { +/* Note that this is a sample function for the purpose of running the below CustomFunctionsMappings test. */ +function addTen(n: number) { return n + 10; } -CustomFunctionMappings = { - addTen: ADD10 -}; +/*Assume that the function id for addTen in the function's JSON metadata is specified as ADDTEN. */ +CustomFunctionMappings.ADDTEN = addTen; async function getStockValues(ticker: string): Promise { const response = await fetch(`myService.com/prices/${ticker}`); diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index 58acfaa6c0..6782404033 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -9,16 +9,17 @@ office-js Copyright (c) Microsoft Corporation */ -//////////////////////////////////////////////////////////////// -//////////////////// Begin custom-functions-runtime //////////// -//////////////////////////////////////////////////////////////// - /** - * Enables you to map your own name that uses lowercase letters to a function. + * Specific to Excel Custom Functions. Enables you to set key-value pairs (a function's JSON id : JavaScript name). */ declare let CustomFunctionMappings: { [key: string]: Function }; - +/** + * CustomFunctions namespace, used by Excel Custom Functions + */ declare namespace CustomFunctions { + /** + * StreamingHandler interface + */ interface StreamingHandler extends CancelableHandler { /** * Sets the returned result for a streaming custom function. @@ -26,7 +27,9 @@ declare namespace CustomFunctions { */ setResult: (value: T | Error) => void; } - + /** + * CancelableHandler interface + */ interface CancelableHandler { /** * Handles what should occur when a custom function is canceled. @@ -35,7 +38,3 @@ declare namespace CustomFunctions { onCanceled: () => void; } } - -//////////////////////////////////////////////////////////////// -//////////////////// End custom-functions-runtime //////////// -//////////////////////////////////////////////////////////////// diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 76445db011..8b22ce17c2 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -75,7 +75,7 @@ declare namespace OfficeRuntime { */ multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; } - /* + /** * @beta * Object representing the dialog box. */ @@ -111,12 +111,12 @@ declare namespace OfficeRuntime { * True if title is hidden from the dialog box. */ hideTitle?: boolean; - /* + /** * @beta * Callback that is run when the dialog box is closed. */ onClose?: () => void; - /* + /** * @beta * Callback that is run when the dialog sends a message to its parent. */