> For the complete documentation index, see [llms.txt](https://signum-network.gitbook.io/signumjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://signum-network.gitbook.io/signumjs/reference/api-reference/monitor-module.md).

# Monitor Module

{% hint style="warning" %}
This module is still in an experimental stage
{% endhint %}

### Installation

{% tabs %}
{% tab title="npm" %}

```
npm i @signumjs/monitor
```

{% endtab %}

{% tab title="yarn" %}

```
yarn add @signumjs/monitor
```

{% endtab %}

{% tab title="<script/>" %}

```html
<script src='https://cdn.jsdelivr.net/npm/@signumjs/monitor/dist/signumjs.monitor.min.js'></script>
```

The namespace is `sig$monitor`

```javascript
// Create an account monitor
const monitor = new sig$monitor.Monitor({
   asyncFetcherFn: tryFetchAccount,
   compareFn: checkIfAccountExists,
   intervalSecs: 10, // polling interval in seconds
   key: 'monitor-account',
   timeoutSecs: 2 * 240 // when reached timeout the monitor stops
})
.onFulfilled(() => {
   // called when `checkIfAccountExists` returns true
   console.log('Yay, account active');
})
.onTimeout(() => {
   // called when `timeoutSecs` is reached
   console.log('Hmm, something went wrong');
}).start();
```

{% endtab %}
{% endtabs %}

### API Reference

{% embed url="<https://signum-network.github.io/signumjs/modules/monitor.html>" %}
