# AICreateMonitor

```typescript
(m: EventTarget) => void
```

A function which is passed an event target allowing it to monitor the creation progress. The monitor is normally updated when the model needs to be downloaded.

### The `downloadprogress` event

#### loaded `number`

The number of bytes downloaded so far

#### total `number`

The total number of bytes to download

#### model `string`

The id of the model that's being downloaded

## Usage

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

```javascript
window.ai.languageModel.create({
  monitor: (m) => {
    m.addEventListener('downloadprogress', ({ loaded, total, model }) => {
      console.log(`${model} = `${Math.round(loaded / total * 100)}`)
    })
  }
})
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
window.ai.languageModel.create({
  monitor: (m: EventTarget) => {
    m.addEventListener('downloadprogress', ({ loaded, total, model }) => {
      console.log(`${model} = `${Math.round(loaded / total * 100)}`)
    })
  }
})
```

{% endtab %}
{% endtabs %}


---

# 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://docs.aibrow.ai/api-reference/types/aicreatemonitor.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.
