Skip to content

Instantly share code, notes, and snippets.

@akrantz
Created March 21, 2019 04:01
Show Gist options
  • Save akrantz/2b013f2e34173839c75733353b8ebd79 to your computer and use it in GitHub Desktop.
Save akrantz/2b013f2e34173839c75733353b8ebd79 to your computer and use it in GitHub Desktop.
name: cancelable function
description: ''
host: EXCEL
api_set: {}
script:
content: |-
/**
* An example of a cancelable function
* @customfunction
*/
function cancelable(invocation: CustomFunctions.CancelableInvocation) {
const timeout = setTimeout(() => console.log("TIMEOUT"), 10000);
invocation.onCanceled = () => {
clearTimeout(timeout);
console.log("CLEARED");
};
console.log(invocation);
}
language: typescript
libraries: |
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
@types/office-js
[email protected]/dist/css/fabric.min.css
[email protected]/dist/css/fabric.components.min.css
[email protected]/client/core.min.js
@types/core-js
@microsoft/[email protected]/dist/office.helpers.min.js
@microsoft/[email protected]/dist/office.helpers.d.ts
[email protected]
@types/[email protected]
@types/custom-functions-runtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment