---
# System prepended metadata

title: Observing properties
tags: [zeta-dom]

---

---
tags: zeta-dom
---

Zeta DOM » [Disposables](/XigonPlaT-eWEEbN1jMglw)

# Observing properties

The `watch` function returns an unregistering callback that unwatches the property.

```typescript
// listen obj.prop until value becomes 2
const unbind = watch(obj, 'prop', (value) => {
    if (value === 2) {
        unbind();
    }
});
```

## Related function

Alternatively, use `watchOnce` for one-off listening:

```typescript
let promise = watchOnce(obj, 'prop');
```
