---
# System prepended metadata

title: Native DOM events
tags: [zeta-dom]

---

---
tags: zeta-dom
---

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

# Native DOM events

```typescript
const unbind = bind(window, {
    click(e) {/* ... */},
    keypress(e) {/* ... */},
});

doSomeLongTask().then(() => {
    unbind();
});
```

By such, when `unbind` is called, the two event listeners will be removed from DOM.

## Related function

Alternatively, providing a promise, use `bindUntil`:

```typescript
bindUtil(promise, window, 'click', (e) => {/* ... */});
```
