[**SixL client API**](../../README.md)

***

[SixL client API](../../README.md) / [browser](../README.md) / BrowserMpPool

# Interface: BrowserMpPool

The browsers of this client: `mp.browsers`. The pool keeps every browser that is not destroyed.

## Example

```ts
const hud = mp.browsers.new('package://ui/index.html');
```

## Constructors

### Constructor

> **new BrowserMpPool**(`url`): [`BrowserMp`](BrowserMp.md)

Creates a page over the game and loads the address in it. The page is shown at once (`active` is `true`).

#### Parameters

##### url

`string`

The address: a `package://` path or an `https://` address.

#### Returns

[`BrowserMp`](BrowserMp.md)

The new browser. Its `browserCreated` event is raised after this call returns.

#### Remarks

The page is drawn over the game with a transparent background. The address loads in the background.

#### Example

```ts
const menu = mp.browsers.new('package://ui/menu.html');
```

## Properties

### length

> `readonly` **length**: `number`

The number of live browsers.

#### Example

```ts
mp.console.logInfo('pages: ' + mp.browsers.length);
```

## Methods

### at()

> **at**(`id`): [`BrowserMp`](BrowserMp.md)

The browser with this id, or `undefined` if there is none (never created, or destroyed).

#### Parameters

##### id

`number`

The browser's `id`, 1 or more.

#### Returns

[`BrowserMp`](BrowserMp.md)

The browser, or `undefined`.

#### Example

```ts
const same = mp.browsers.at(1);
```

***

### exists()

> **exists**(`browser`): `boolean`

Whether the value is a browser of this pool that is not destroyed.

#### Parameters

##### browser

`unknown`

Any value.

#### Returns

`boolean`

`true` for a live browser of this client, `false` for anything else.

#### Example

```ts
if (mp.browsers.exists(hud)) hud.reload();
```

***

### forEach()

> **forEach**(`callingFunction`): `void`

Calls `callingFunction` for every live browser, in the order of creation.

#### Parameters

##### callingFunction

(`entity`) => `void`

Called with each browser. The calls go over the list taken before the first call, so a
browser destroyed inside the loop is still passed.

#### Returns

`void`

#### Example

```ts
mp.browsers.forEach((page) => page.reload());
```

***

### toArray()

> **toArray**(): [`BrowserMp`](BrowserMp.md)[]

The live browsers as a new array, in the order of creation.

#### Returns

[`BrowserMp`](BrowserMp.md)[]

A new array; changing it does not change the pool.

#### Example

```ts
const pages = mp.browsers.toArray();
```
