changing folder name

This commit is contained in:
mscharlock
2018-09-13 14:24:21 -07:00
parent 93b35befe8
commit 5ef968bffe
4 changed files with 164 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
function ADD10(n: number) {
return n + 10;
}
declare const CustomFunctionMappings: {
"addTen": ADD10();
};
async function getStockValues(ticker: string, handler: CustomFunctions.StreamingHandler<number>) {
const dollars = await (await fetch(`myService.com/prices/${ticker}`)).json();
handler.setResult(dollars)
}
async function getStockValuesOneTime(ticker: string, handler: CustomFunctions.CancelableHandler) {
var shouldStop = false;
handler.onCanceled = () => shouldStop = true;
await pause(1000);
if (shouldStop) {
return null;
}
const dollars = await (await fetch(`myService.com/prices/${ticker}`)).json();
return dollars;
}
async function getStockValuesNowWithNoCancelling(ticker: string) {
const dollars = await (await fetch(`myService.com/prices/${ticker}`)).json();
return dollars;
}
declare function pause(ms: number): Promise<void>

View File

@@ -0,0 +1,30 @@
// Type definitions for Custom Functions
// Project: http://dev.office.com
// Definitions by: OfficeDev <https://github.com/OfficeDev>, Michael Zlatkovsky <https://github.com/Zlatkovsky>, Michelle Scharlock <https://github.com/mscharlock>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/*
office-js
Copyright (c) Microsoft Corporation
*/
declare const CustomFunctionMappings: { [key: string]: Function };
declare namespace CustomFunctions {
interface StreamingHandler<T> extends CancelableHandler {
/*
* Sets the returned result for a streaming custom function.
* @beta
*/
setResult: (value: T) => void;
}
interface CancelableHandler {
/*
* Handles what should occur when a custom function is canceled.
* @beta
*/
onCanceled: () => void;
}
}

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"target": "es6"
},
"files": [
"index.d.ts",
"office-runtime-tests.ts"
]
}

View File

@@ -0,0 +1,79 @@
{
"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
}
}