From 6f8c4c842792536c9d814b59599140dcaa613eae Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Mon, 17 Sep 2018 09:43:54 -0700 Subject: [PATCH 01/17] Update index.d.ts --- types/office-runtime/index.d.ts | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 4e45c8dc82..6d62d78688 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -14,7 +14,7 @@ declare namespace OfficeRuntime { const AsyncStorage: AsyncStorage; // tslint:disable-next-line:interface-name - /** + /* * Asynchronous, global, and persistent key-value storage for Excel Custom Functions only. * @beta * @@ -27,32 +27,32 @@ declare namespace OfficeRuntime { * */ interface AsyncStorage { - /** + /* * @beta * Retrieves an object based on a key and invokes a callback when finished. Returns a Promise. * */ getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; - /** + /* * @beta * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. * */ setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; - /** + /* * @beta * Removes an item for specified key and invokes a callback when finished. Returns a Promise. * * */ removeItem(key: string, callback?: (error?: Error) => void): Promise; - /** + /* * @beta * Erases all AsyncStorage. Returns a Promise. * */ clear(callback?: (error?: Error) => void): Promise; - /** + /* * @beta * Returns a Promise with all keys for your custom function. * @@ -64,13 +64,13 @@ declare namespace OfficeRuntime { * */ multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; - /** + /* * @beta * Deletes a batch of keys, specified in the `keys` array. * */ multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise;/** - /** + /* * @beta * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. * @@ -78,33 +78,33 @@ declare namespace OfficeRuntime { multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; } - /** + /* * @beta * Object representing the dialog box for Excel Custom Functions only. * */ interface Dialog { - /** + /* * @beta * Method that closes a dialog box. */ close(): Promise; } - /** + /* * * Provides options for how a dialog is displayed for Excel Custom Functions only. * */ interface DisplayWebDialogOptions { - /** + /* * @beta * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. * * [Api set: Dialog 1.2] */ displayInIFrame?: boolean; - /** + /* * @beta * Defines the height of the dialog box as a percentage of the current display. * @@ -120,7 +120,7 @@ declare namespace OfficeRuntime { */ width?: string; - /** + /* * @beta * True if title is hidden from the dialog box. * @@ -128,7 +128,7 @@ declare namespace OfficeRuntime { */ hideTitle?: boolean; - /** + /* * @beta * Callback that is run when the dialog box sends a message to its parent. * @@ -136,7 +136,7 @@ declare namespace OfficeRuntime { */ onMessage?: (message: string, dialog?: Dialog) => void; - /** + /* * @beta * Callback that is run when the dialog box is closed. * @@ -144,12 +144,12 @@ declare namespace OfficeRuntime { */ onClose?: () => void; - /** + /* * @beta * Callback that is run when the dialog box sends an error. * * */ - onRuntimeError?: (error: Error, dialog?: Dialog) => void; + onMessage?(message: string, dialog?: Dialog): void } } From 0badead1af0532d00cf7e7a39e7cf21c3a11ceed Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Mon, 17 Sep 2018 09:46:32 -0700 Subject: [PATCH 02/17] Update index.d.ts --- types/office-runtime/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 6d62d78688..d8915fbf97 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -58,7 +58,7 @@ declare namespace OfficeRuntime { * */ getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; - /** + /* * @beta * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. * From 155358277dc81ce2c92cbff890e799eb5917c82f Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Mon, 17 Sep 2018 09:47:25 -0700 Subject: [PATCH 03/17] minor fix --- types/office-runtime/office-runtime-tests.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts index a8d8f09675..1b422ba1ed 100644 --- a/types/office-runtime/office-runtime-tests.ts +++ b/types/office-runtime/office-runtime-tests.ts @@ -55,10 +55,10 @@ OfficeRuntime.displayWebDialog("https://localhost:3000", { width: '50%', displayInIFrame: false, hideTitle: true, -     onMessage: (message, dialog) => { -         console.log(message); -             dialog.close(); -             } +    onMessage: (message, dialog) => { + console.log(message); + dialog.close(); + } } ) @@ -74,4 +74,4 @@ OfficeRuntime.displayWebDialog("https://localhost:3000", { console.log(error); dialog.close(); } -}) \ No newline at end of file +}) From 866c802cf7ee68859f917cd256de3c585eef17ea Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Mon, 17 Sep 2018 09:51:01 -0700 Subject: [PATCH 04/17] Editing out the long list of lint things as we may not need them --- types/office-runtime/tslint.json | 80 +------------------------------- 1 file changed, 2 insertions(+), 78 deletions(-) diff --git a/types/office-runtime/tslint.json b/types/office-runtime/tslint.json index 5c50b51e66..f93cf8562a 100644 --- a/types/office-runtime/tslint.json +++ b/types/office-runtime/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} \ No newline at end of file + "extends": "dtslint/dt.json" +} From b3bf8ded031de9dbccedfc4992fc0431421eacaa Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Tue, 18 Sep 2018 09:26:11 -0700 Subject: [PATCH 05/17] removing spaces --- types/office-runtime/index.d.ts | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index d8915fbf97..e3583e2a8f 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -29,51 +29,42 @@ declare namespace OfficeRuntime { interface AsyncStorage { /* * @beta - * Retrieves an object based on a key and invokes a callback when finished. Returns a Promise. - * + * Retrieves an object based on a key and invokes a callback when finished. Returns a Promise. */ getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; /* * @beta * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. - * */ setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; /* * @beta * Removes an item for specified key and invokes a callback when finished. Returns a Promise. - * - * */ removeItem(key: string, callback?: (error?: Error) => void): Promise; /* * @beta * Erases all AsyncStorage. Returns a Promise. - * */ clear(callback?: (error?: Error) => void): Promise; /* * @beta * Returns a Promise with all keys for your custom function. - * */ getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; /* * @beta * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. - * */ multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; /* * @beta * Deletes a batch of keys, specified in the `keys` array. - * */ multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise;/** /* * @beta * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. - * */ multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; } @@ -81,7 +72,6 @@ declare namespace OfficeRuntime { /* * @beta * Object representing the dialog box for Excel Custom Functions only. - * */ interface Dialog { /* @@ -92,9 +82,7 @@ declare namespace OfficeRuntime { } /* - * * Provides options for how a dialog is displayed for Excel Custom Functions only. - * */ interface DisplayWebDialogOptions { /* @@ -131,24 +119,18 @@ declare namespace OfficeRuntime { /* * @beta * Callback that is run when the dialog box sends a message to its parent. - * - * */ onMessage?: (message: string, dialog?: Dialog) => void; /* * @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. - * - * */ onMessage?(message: string, dialog?: Dialog): void } From 8409fb07b211bf95fe3645c8cf51c4aeb7dad4d2 Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Tue, 18 Sep 2018 09:27:42 -0700 Subject: [PATCH 06/17] Update tsconfig.json --- types/office-runtime/tsconfig.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/office-runtime/tsconfig.json b/types/office-runtime/tsconfig.json index 0609e72ad0..75d7064acb 100644 --- a/types/office-runtime/tsconfig.json +++ b/types/office-runtime/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, @@ -20,4 +19,4 @@ "index.d.ts", "office-runtime-tests.ts" ] -} \ No newline at end of file +} From 97a40fb289a95d2f1801f64945741989bbc77008 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 09:37:40 -0700 Subject: [PATCH 07/17] fixes --- types/office-runtime/index.d.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index e3583e2a8f..34eaf48c23 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for office-runtime +// Type definitions for office-runtime 1.0 // Project: http://dev.office.com/ // Definitions by: Michael Zlatskovsky , Michelle Scharlock // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -61,7 +61,7 @@ declare namespace OfficeRuntime { * @beta * Deletes a batch of keys, specified in the `keys` array. */ - multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise;/** + multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise; /* * @beta * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. @@ -116,13 +116,7 @@ declare namespace OfficeRuntime { */ hideTitle?: boolean; - /* - * @beta - * Callback that is run when the dialog box sends a message to its parent. - */ - onMessage?: (message: string, dialog?: Dialog) => void; - - /* + /* * @beta * Callback that is run when the dialog box is closed. */ From c2f92b7c3026d9f03f268c52b55acbf921d65693 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 09:40:05 -0700 Subject: [PATCH 08/17] fixes --- types/office-runtime/office-runtime-tests.ts | 63 +++++++++----------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts index 1b422ba1ed..667eb2e84b 100644 --- a/types/office-runtime/office-runtime-tests.ts +++ b/types/office-runtime/office-runtime-tests.ts @@ -4,74 +4,67 @@ Copyright (c) Microsoft Corporation */ OfficeRuntime.AsyncStorage.getItem("foo", () => { - //do a thing + // perform an action }) -OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)) +OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)); OfficeRuntime.AsyncStorage.setItem("foo", "bar"); -OfficeRuntime.AsyncStorage.setItem("foo", "bar").then(error => console.log(error)) +OfficeRuntime.AsyncStorage.setItem("foo", "bar").then(error => console.log(error)); -OfficeRuntime.AsyncStorage.removeItem("foo"); +OfficeRuntime.AsyncStorage.removeItem("foo"); OfficeRuntime.AsyncStorage.removeItem("foo", () => { - //do a thing -}) + // perform an action +}); OfficeRuntime.AsyncStorage.clear(); OfficeRuntime.AsyncStorage.clear(() => { - //do a thing -}) + // perform an action +}); OfficeRuntime.AsyncStorage.getAllKeys().then(keys => { keys.forEach(item => console.log(item)); -}) +}); + OfficeRuntime.AsyncStorage.getAllKeys((error, keys) => { if (error) { - console.error(error); + console.error(error); } else { keys.forEach(item => console.log(item)); } -}) +}); OfficeRuntime.AsyncStorage.multiSet( - [["username", "foo"], ["yearOfBirth", "2001"]], + [["username", "foo"], ["yearOfBirth", "2001"]], errors => { errors.filter(error => error != null).forEach(error => console.log(error)); } -) +); -OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]); -OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]).then(value => console.log(value)) +OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]); +OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]).then(value => console.log(value)); OfficeRuntime.AsyncStorage.multiGet(["username", "yearOfBirth"]).then( values => { - console.log(values[0][1]) - console.log(values[1][1]) + console.log(values[0][1]); + console.log(values[1][1]); } -) - - -OfficeRuntime.displayWebDialog("https://localhost:3000", { - height: '50', - width: '50%', - displayInIFrame: false, - hideTitle: true, -    onMessage: (message, dialog) => { - console.log(message); - dialog.close(); - } - } -) +); +OfficeRuntime.displayWebDialog("https://localhost:3000", { + height: 50, + width: 50%, + displayInIFrame: false +}); OfficeRuntime.displayWebDialog("https://localhost:3000", { onClose: () => { - console.log("closed"); + console.log("closed"); } -}) +}); OfficeRuntime.displayWebDialog("https://localhost:3000", { onRuntimeError: (error, dialog) => { - console.log(error); + console.log(error); dialog.close(); } -}) +}); From 25fe3a5300bfedd140baa00d54349a49eb8c81dc Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 09:47:19 -0700 Subject: [PATCH 09/17] ch ch ch changes --- types/office-runtime/index.d.ts | 18 +++++------------- types/office-runtime/office-runtime-tests.ts | 11 +---------- types/office-runtime/tsconfig.json | 3 ++- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 34eaf48c23..0847829553 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -15,7 +15,7 @@ declare namespace OfficeRuntime { // tslint:disable-next-line:interface-name /* - * Asynchronous, global, and persistent key-value storage for Excel Custom Functions only. + * Asynchronous, global, and persistent key-value storage that can be used by Excel Custom Functions. * @beta * * @remarks @@ -49,7 +49,7 @@ declare namespace OfficeRuntime { clear(callback?: (error?: Error) => void): Promise; /* * @beta - * Returns a Promise with all keys for your custom function. + * Returns a Promise with all keys. */ getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; /* @@ -71,7 +71,7 @@ declare namespace OfficeRuntime { /* * @beta - * Object representing the dialog box for Excel Custom Functions only. + * Object representing the dialog box. */ interface Dialog { /* @@ -82,37 +82,29 @@ declare namespace OfficeRuntime { } /* - * Provides options for how a dialog is displayed for Excel Custom Functions only. + * Provides options for how a dialog is displayed. */ interface DisplayWebDialogOptions { /* * @beta * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. - * - * [Api set: Dialog 1.2] */ displayInIFrame?: boolean; /* * @beta * Defines the height of the dialog box as a percentage of the current display. - * - * [Api set: Dialog 1.2] */ height?: string; /** * @beta * Defines the width of the dialog box as a percentage of the current display. - * - * [Api set: Dialog 1.2] */ width?: string; /* * @beta * True if title is hidden from the dialog box. - * - * [Api set: Dialog 1.2] */ hideTitle?: boolean; @@ -126,6 +118,6 @@ declare namespace OfficeRuntime { * @beta * Callback that is run when the dialog box sends an error. */ - onMessage?(message: string, dialog?: Dialog): void + onMessage?(message: string, dialog?: Dialog): void } } diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts index 667eb2e84b..889665b3df 100644 --- a/types/office-runtime/office-runtime-tests.ts +++ b/types/office-runtime/office-runtime-tests.ts @@ -5,7 +5,7 @@ Copyright (c) Microsoft Corporation OfficeRuntime.AsyncStorage.getItem("foo", () => { // perform an action -}) +}); OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)); OfficeRuntime.AsyncStorage.setItem("foo", "bar"); @@ -51,8 +51,6 @@ OfficeRuntime.AsyncStorage.multiGet(["username", "yearOfBirth"]).then( ); OfficeRuntime.displayWebDialog("https://localhost:3000", { - height: 50, - width: 50%, displayInIFrame: false }); @@ -61,10 +59,3 @@ OfficeRuntime.displayWebDialog("https://localhost:3000", { console.log("closed"); } }); - -OfficeRuntime.displayWebDialog("https://localhost:3000", { - onRuntimeError: (error, dialog) => { - console.log(error); - dialog.close(); - } -}); diff --git a/types/office-runtime/tsconfig.json b/types/office-runtime/tsconfig.json index 75d7064acb..f8559f2ebd 100644 --- a/types/office-runtime/tsconfig.json +++ b/types/office-runtime/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From 03634965e7f146d7ddcab37c9190d56ed7418d18 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 10:12:17 -0700 Subject: [PATCH 10/17] changes --- types/office-runtime/index.d.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 0847829553..216e2f2adc 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -12,18 +12,18 @@ Copyright (c) Microsoft Corporation declare namespace OfficeRuntime { function displayWebDialog(url: string, options: DisplayWebDialogOptions): Promise; const AsyncStorage: AsyncStorage; - + // tslint:disable-next-line:interface-name /* * Asynchronous, global, and persistent key-value storage that can be used by Excel Custom Functions. * @beta * - * @remarks - * Each add-in instance has its own storage partition, unique to a user and their device. + * @remarks + * Each add-in instance has its own storage partition, unique to a user and their device. * - * The default amount of total storage allowed per add-in is 5MB. + * The default amount of total storage allowed per add-in is 5MB. * - * Each method listed below returns a Promise object. + * Each method listed below returns a Promise object. * */ interface AsyncStorage { @@ -34,27 +34,27 @@ declare namespace OfficeRuntime { getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; /* * @beta - * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. + * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. */ setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; /* * @beta - * Removes an item for specified key and invokes a callback when finished. Returns a Promise. + * Removes an item for specified key and invokes a callback when finished. Returns a Promise. */ removeItem(key: string, callback?: (error?: Error) => void): Promise; /* * @beta - * Erases all AsyncStorage. Returns a Promise. + * Erases all AsyncStorage. Returns a Promise. */ clear(callback?: (error?: Error) => void): Promise; /* * @beta - * Returns a Promise with all keys. + * Returns a Promise with all keys. */ getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; /* * @beta - * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. + * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. */ multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; /* @@ -64,11 +64,10 @@ declare namespace OfficeRuntime { multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise; /* * @beta - * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. + * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. */ multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; } - /* * @beta * Object representing the dialog box. From f6166df47366ef512f47bbdf2c6deb30fa5420c8 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 10:14:46 -0700 Subject: [PATCH 11/17] spaces --- types/office-runtime/index.d.ts | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 216e2f2adc..74cb1179a3 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -20,11 +20,11 @@ declare namespace OfficeRuntime { * * @remarks * Each add-in instance has its own storage partition, unique to a user and their device. - * + * * The default amount of total storage allowed per add-in is 5MB. - * + * * Each method listed below returns a Promise object. - * + * */ interface AsyncStorage { /* @@ -34,7 +34,7 @@ declare namespace OfficeRuntime { getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; /* * @beta - * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. + * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. */ setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; /* @@ -70,23 +70,23 @@ declare namespace OfficeRuntime { } /* * @beta - * Object representing the dialog box. + * Object representing the dialog box. */ interface Dialog { /* * @beta - * Method that closes a dialog box. + * Method that closes a dialog box. */ close(): Promise; } /* - * Provides options for how a dialog is displayed. + * Provides options for how a dialog is displayed. */ interface DisplayWebDialogOptions { /* * @beta - * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. + * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. */ displayInIFrame?: boolean; /* @@ -94,25 +94,21 @@ declare namespace OfficeRuntime { * Defines the height of the dialog box as a percentage of the current display. */ height?: string; - - /** - * @beta - * Defines the width of the dialog box as a percentage of the current display. - */ - width?: string; - /* * @beta - * True if title is hidden from the dialog box. + * Defines the width of the dialog box as a percentage of the current display. + */ + width?: string; + /* + * @beta + * 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 2c2c7e2acd34d93b1f5d21d80ce3ed1f1fa9ab7f Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 10:17:01 -0700 Subject: [PATCH 12/17] lint fix --- types/office-runtime/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 74cb1179a3..bb0d779b11 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -79,7 +79,7 @@ declare namespace OfficeRuntime { */ close(): Promise; } - + /* * Provides options for how a dialog is displayed. */ @@ -113,6 +113,6 @@ declare namespace OfficeRuntime { * @beta * Callback that is run when the dialog box sends an error. */ - onMessage?(message: string, dialog?: Dialog): void + onMessage?(message: string, dialog?: Dialog): void; } } From 4178768102da715d2254bae2997d37d828cc9886 Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Tue, 18 Sep 2018 10:22:24 -0700 Subject: [PATCH 13/17] Update index.d.ts --- types/office-runtime/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index bb0d779b11..3f57014bc9 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -79,7 +79,6 @@ declare namespace OfficeRuntime { */ close(): Promise; } - /* * Provides options for how a dialog is displayed. */ From 502af779fb6a9c77f1d30e6ad5af34e01283a0dd Mon Sep 17 00:00:00 2001 From: mscharlock Date: Wed, 19 Sep 2018 21:34:31 -0700 Subject: [PATCH 14/17] adding comment --- types/custom-functions-runtime/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index e233a869fd..3b44fb9d21 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -9,6 +9,9 @@ office-js Copyright (c) Microsoft Corporation */ +/* +* Enables you to map your own name that uses lowercase letters to a function. +*/ declare let CustomFunctionMappings: { [key: string]: Function }; declare namespace CustomFunctions { From 08d723da665a627a31cbe6a38235a3f34e535896 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Thu, 20 Sep 2018 11:49:42 -0700 Subject: [PATCH 15/17] adding comments & end/begin --- types/custom-functions-runtime/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index 3b44fb9d21..94c58c6b7b 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -9,6 +9,11 @@ office-js Copyright (c) Microsoft Corporation */ + +//////////////////////////////////////////////////////////////// +//////////////////// Begin custom-functions-runtime //////////// +//////////////////////////////////////////////////////////////// + /* * Enables you to map your own name that uses lowercase letters to a function. */ @@ -31,3 +36,8 @@ declare namespace CustomFunctions { onCanceled: () => void; } } + + +//////////////////////////////////////////////////////////////// +//////////////////// BEnd custom-functions-runtime //////////// +//////////////////////////////////////////////////////////////// \ No newline at end of file From 5542f92ec15f5642166896e17260194e849c454f Mon Sep 17 00:00:00 2001 From: mscharlock Date: Thu, 20 Sep 2018 11:55:15 -0700 Subject: [PATCH 16/17] remove office things --- types/office-runtime/index.d.ts | 117 ------------------- types/office-runtime/office-runtime-tests.ts | 61 ---------- types/office-runtime/tslint.json | 3 - 3 files changed, 181 deletions(-) delete mode 100644 types/office-runtime/index.d.ts delete mode 100644 types/office-runtime/office-runtime-tests.ts delete mode 100644 types/office-runtime/tslint.json diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts deleted file mode 100644 index 3f57014bc9..0000000000 --- a/types/office-runtime/index.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -// Type definitions for office-runtime 1.0 -// Project: http://dev.office.com/ -// Definitions by: Michael Zlatskovsky , Michelle Scharlock -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Typescript Version: 2.4 - -/* -office-runtime -Copyright (c) Microsoft Corporation -*/ - -declare namespace OfficeRuntime { - function displayWebDialog(url: string, options: DisplayWebDialogOptions): Promise; - const AsyncStorage: AsyncStorage; - - // tslint:disable-next-line:interface-name - /* - * Asynchronous, global, and persistent key-value storage that can be used by Excel Custom Functions. - * @beta - * - * @remarks - * Each add-in instance has its own storage partition, unique to a user and their device. - * - * The default amount of total storage allowed per add-in is 5MB. - * - * Each method listed below returns a Promise object. - * - */ - interface AsyncStorage { - /* - * @beta - * Retrieves an object based on a key and invokes a callback when finished. Returns a Promise. - */ - getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; - /* - * @beta - * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. - */ - setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; - /* - * @beta - * Removes an item for specified key and invokes a callback when finished. Returns a Promise. - */ - removeItem(key: string, callback?: (error?: Error) => void): Promise; - /* - * @beta - * Erases all AsyncStorage. Returns a Promise. - */ - clear(callback?: (error?: Error) => void): Promise; - /* - * @beta - * Returns a Promise with all keys. - */ - getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; - /* - * @beta - * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. - */ - multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; - /* - * @beta - * Deletes a batch of keys, specified in the `keys` array. - */ - multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise; - /* - * @beta - * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. - */ - multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; - } - /* - * @beta - * Object representing the dialog box. - */ - interface Dialog { - /* - * @beta - * Method that closes a dialog box. - */ - close(): Promise; - } - /* - * Provides options for how a dialog is displayed. - */ - interface DisplayWebDialogOptions { - /* - * @beta - * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. - */ - displayInIFrame?: boolean; - /* - * @beta - * Defines the height of the dialog box as a percentage of the current display. - */ - height?: string; - /* - * @beta - * Defines the width of the dialog box as a percentage of the current display. - */ - width?: string; - /* - * @beta - * 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. - */ - onMessage?(message: string, dialog?: Dialog): void; - } - } diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts deleted file mode 100644 index 889665b3df..0000000000 --- a/types/office-runtime/office-runtime-tests.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* -office-runtime -Copyright (c) Microsoft Corporation -*/ - -OfficeRuntime.AsyncStorage.getItem("foo", () => { - // perform an action -}); -OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)); - -OfficeRuntime.AsyncStorage.setItem("foo", "bar"); -OfficeRuntime.AsyncStorage.setItem("foo", "bar").then(error => console.log(error)); - -OfficeRuntime.AsyncStorage.removeItem("foo"); -OfficeRuntime.AsyncStorage.removeItem("foo", () => { - // perform an action -}); - -OfficeRuntime.AsyncStorage.clear(); -OfficeRuntime.AsyncStorage.clear(() => { - // perform an action -}); - -OfficeRuntime.AsyncStorage.getAllKeys().then(keys => { - keys.forEach(item => console.log(item)); -}); - -OfficeRuntime.AsyncStorage.getAllKeys((error, keys) => { - if (error) { - console.error(error); - } else { - keys.forEach(item => console.log(item)); - } -}); - -OfficeRuntime.AsyncStorage.multiSet( - [["username", "foo"], ["yearOfBirth", "2001"]], - errors => { - errors.filter(error => error != null).forEach(error => console.log(error)); - } -); - -OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]); -OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]).then(value => console.log(value)); - -OfficeRuntime.AsyncStorage.multiGet(["username", "yearOfBirth"]).then( - values => { - console.log(values[0][1]); - console.log(values[1][1]); - } -); - -OfficeRuntime.displayWebDialog("https://localhost:3000", { - displayInIFrame: false -}); - -OfficeRuntime.displayWebDialog("https://localhost:3000", { - onClose: () => { - console.log("closed"); - } -}); diff --git a/types/office-runtime/tslint.json b/types/office-runtime/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/office-runtime/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} From ec31abdd97454f547cb443a5d22c7968252ff9d5 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Thu, 20 Sep 2018 12:11:18 -0700 Subject: [PATCH 17/17] fix line spacing --- types/custom-functions-runtime/index.d.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index b031862efb..b20d38828e 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -9,13 +9,12 @@ office-js Copyright (c) Microsoft Corporation */ - //////////////////////////////////////////////////////////////// //////////////////// Begin custom-functions-runtime //////////// //////////////////////////////////////////////////////////////// -/* -* Enables you to map your own name that uses lowercase letters to a function. +/* +* Enables you to map your own name that uses lowercase letters to a function. */ declare let CustomFunctionMappings: { [key: string]: Function }; @@ -37,7 +36,6 @@ declare namespace CustomFunctions { } } - //////////////////////////////////////////////////////////////// //////////////////// End custom-functions-runtime //////////// -//////////////////////////////////////////////////////////////// \ No newline at end of file +////////////////////////////////////////////////////////////////