From 916e3b82e9acb65ef88313394c8b3d500ff2d96f Mon Sep 17 00:00:00 2001 From: mscharlock Date: Fri, 28 Sep 2018 18:38:47 -0700 Subject: [PATCH 1/5] updates to comments --- types/office-runtime/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index ae86c01bcb..52793d4757 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 box sends an error. */ From 011032596aef111360b918df03fa39d9b1e285b3 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Fri, 28 Sep 2018 18:39:23 -0700 Subject: [PATCH 2/5] update to custom-function-runtime --- types/custom-functions-runtime/index.d.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index 58acfaa6c0..cfef89b7e3 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 where the key is the uppercase id of a function in the custom function's JSON metadata file and the value is the name of the function as defined in the function's JavaScript file. */ 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. @@ -34,8 +37,4 @@ declare namespace CustomFunctions { */ onCanceled: () => void; } -} - -//////////////////////////////////////////////////////////////// -//////////////////// End custom-functions-runtime //////////// -//////////////////////////////////////////////////////////////// +} \ No newline at end of file From 83f1c8db45d7ae8a4374125f86e54be824003fae Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 2 Oct 2018 13:10:30 -0700 Subject: [PATCH 3/5] fixes to long comment --- types/custom-functions-runtime/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index cfef89b7e3..59b998b97d 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -10,7 +10,7 @@ Copyright (c) Microsoft Corporation */ /** - * Specific to Excel Custom Functions. Enables you to set key-value pairs where the key is the uppercase id of a function in the custom function's JSON metadata file and the value is the name of the function as defined in the function's JavaScript file. + * Specific to Excel Custom Functions. Enables you to set key-value pairs (uppercase id of a function in the custom function's JSON metadata file: the name of the function as defined in the function's JavaScript file). */ declare let CustomFunctionMappings: { [key: string]: Function }; /** @@ -37,4 +37,4 @@ declare namespace CustomFunctions { */ onCanceled: () => void; } -} \ No newline at end of file +} From c75538cfe7cc219a490e3233ddd37d081fb9706a Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 2 Oct 2018 13:15:34 -0700 Subject: [PATCH 4/5] cleaning definition of CFMapping so it is accurate --- .../custom-functions-runtime-tests.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/types/custom-functions-runtime/custom-functions-runtime-tests.ts b/types/custom-functions-runtime/custom-functions-runtime-tests.ts index c35c172d7c..b90d9585e2 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) { +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}`); From a2657a73a41ac4910bff5d2788aea3fe9fd46654 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 2 Oct 2018 13:22:54 -0700 Subject: [PATCH 5/5] updating CFMappings to be correct --- .../custom-functions-runtime/custom-functions-runtime-tests.ts | 2 +- types/custom-functions-runtime/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/custom-functions-runtime/custom-functions-runtime-tests.ts b/types/custom-functions-runtime/custom-functions-runtime-tests.ts index b90d9585e2..86eecbedda 100644 --- a/types/custom-functions-runtime/custom-functions-runtime-tests.ts +++ b/types/custom-functions-runtime/custom-functions-runtime-tests.ts @@ -1,4 +1,4 @@ -/* Note that this is a sample function for the purpose of running the below CustomFunctionsMappings test */ +/* Note that this is a sample function for the purpose of running the below CustomFunctionsMappings test. */ function addTen(n: number) { return n + 10; } diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index 59b998b97d..6782404033 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -10,7 +10,7 @@ Copyright (c) Microsoft Corporation */ /** - * Specific to Excel Custom Functions. Enables you to set key-value pairs (uppercase id of a function in the custom function's JSON metadata file: the name of the function as defined in the function's JavaScript file). + * 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 }; /**