# DataConnections.onChange Method

> DataConnections.onChange method in the TX Sheet Control JavaScript API for the browser: Subscribes to lifecycle notifications.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Path:** TX Sheet Control > API Reference > JavaScript API > Browser Editor > DataConnections > DataConnections.onChange Method
- **398 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dataconnections/onchange-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dataconnections/onchange-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dataconnections/onchange-method/llms-full.txt

---

Subscribes to lifecycle notifications; returns an unsubscribe function.

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

### Syntax

```javascript
owner.onChange(listener)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `listener` | `(event: Readonly<DataConnectionEvent>) => void` | No | Value matching listener's declared type and the owning object's validation rules. |

### Return Value

`() => void`.

### Examples

Pass an existing DataConnections 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.

```javascript
function applyDataConnectionsOnChange(dataConnections) {
    const result = dataConnections['onChange']((event) => {
        console.log(event);
    });

    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

- [DataConnections Class](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dataconnections/llms-full.txt)
- [Events and Cancellation](https://docs.textcontrol.com/tx-sheet-control/spreadsheet-editor/events/llms-full.txt)
- [DataConnectionEvent Interface](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/dataconnectionevent/llms-full.txt)

---

## Nearby

- **Previous:** [DataConnections.dispose Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dataconnections/dispose-method/llms-full.txt)
- **Next:** [DataConnections.refresh Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dataconnections/refresh-method/llms-full.txt)
