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