# 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>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://signum-network.gitbook.io/signumjs/reference/api-reference/monitor-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
