# CustomFunctionDefinition.evaluate Method

> CustomFunctionDefinition.evaluate method in the browser TypeScript API, with the return type FunctionValue | Promise<FunctionValue> and a TypeScript example.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > TypeScript API > Browser Editor > CustomFunctionDefinition > CustomFunctionDefinition.evaluate Method
- **673 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/customfunctiondefinition/evaluate-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/customfunctiondefinition/evaluate-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/customfunctiondefinition/evaluate-method/llms-full.txt

---

The evaluate operation of CustomFunctionDefinition.

Owner: [CustomFunctionDefinition](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/customfunctiondefinition/llms-full.txt). Package: `@txtextcontrol/tx-sheet-control`. Version: **2.0.0**.

### Syntax

```typescript
evaluate(arguments_: readonly FunctionValue[], context: CustomFunctionContext): FunctionValue | Promise<FunctionValue>
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `arguments_` | `readonly FunctionValue[]` | No | Value matching arguments\_'s declared type and the owning object's validation rules. |
| `context` | `CustomFunctionContext` | No | Value matching context's declared type and the owning object's validation rules. |

### Return Value

`FunctionValue | Promise<FunctionValue>`.

### Examples

Pass an existing CustomFunctionDefinition from the owning document. Related handles and input bytes must belong to the intended document and application; the function applies the operation and inspects its result.

```typescript
import type { CustomFunctionDefinition } from '@txtextcontrol/tx-sheet-control';

function applyCustomFunctionDefinitionEvaluate(customFunctionDefinition: CustomFunctionDefinition) {
    const result = customFunctionDefinition['evaluate']([], {
        sheetId: 'sales-sheet',
        address: 'B8',
        signal: {
            aborted: false,
            addEventListener: (type, listener) => {
                console.log(type);
            },
            removeEventListener: (type, listener) => {
                console.log(type);
            },
            throwIfAborted: () => {
                console.log('Operation completed');
            },
        },
    });

    console.log(result);
}
```

### Remarks

Use this member on an object from the current document. Reacquire document-bound handles after replacement/deletion. Validate arguments against the declared types and documented bounds; handle exceptions or rejected promises.

### See Also

- [CustomFunctionDefinition Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/customfunctiondefinition/llms-full.txt)
- [Formulas](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/formulas/llms-full.txt)
- [CustomFunctionContext Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/customfunctioncontext/llms-full.txt)
- [FunctionValue Type](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/functionvalue/llms-full.txt)

---

## Nearby

- **Previous:** [CustomFunctionDefinition Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/customfunctiondefinition/llms-full.txt)
- **Next:** [CustomFunctionDefinition.isVolatile Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/customfunctiondefinition/isvolatile-property/llms-full.txt)
