> For the complete documentation index, see [llms.txt](https://bemtv.gitbook.io/bemtvjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bemtv.gitbook.io/bemtvjs/keeping-the-instance-running.md).

# Keeping the instance running

If inside the hook or the DOM event we need to use a function that does not execute immediately we must use the `keepInst()` function, it wraps the function that must be executed and returns a callback that when executed executes the involved function:

```javascript
import { _ } from "bemtv";

const { click$, keepInst, $, template } = _`Counter`({ count: 0 });

click$(() => {
  setTimeout(
    keepInst(() => $.count++),
    1000
  );
});

template`button[Clicked: $count ]`;
```
