Skip to content

Instantly share code, notes, and snippets.

@akrantz
Last active July 19, 2019 20:33
Show Gist options
  • Select an option

  • Save akrantz/623c60ec80829e5775a212fdb08b6e4c to your computer and use it in GitHub Desktop.

Select an option

Save akrantz/623c60ec80829e5775a212fdb08b6e4c to your computer and use it in GitHub Desktop.
A custom function which returns a Promise
name: Custom Function returns a Promise
description: A custom function which returns a Promise
host: EXCEL
api_set: {}
script:
content: |
/**
* Async custom function
* @customfunction
*/
async function doSomething(seconds: number): Promise<number> {
await delay(seconds);
return seconds;
}
async function delay(seconds: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, seconds * 1000));
}
language: typescript
libraries: |
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
@types/office-js
office-ui-fabric-js@1.4.0/dist/css/fabric.min.css
office-ui-fabric-js@1.4.0/dist/css/fabric.components.min.css
core-js@2.4.1/client/core.min.js
@types/core-js
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.min.js
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.d.ts
jquery@3.1.1
@types/jquery@3.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment