---
title: "MediaList | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

# Interface MediaList

The **`MediaList`** interface represents the media queries of a stylesheet, e.g., those set using a  element's media attribute.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaList)

interface MediaList {  
    [length](#length): number;  
    [mediaText](#mediatext): string;  
    ["\[iterator\]"](#iterator-1)(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<string\>;  
    [appendMedium](#appendmedium-1)(medium: string): void;  
    [deleteMedium](#deletemedium-1)(medium: string): void;  
    [item](#item-1)(index: number): string | null;  
    [toString](#tostring-1)(): string;  
    \[index: number\]: string;  
}

#### Indexable

-   \[index: number\]: string
    

##### Index

### Properties[](#properties)

[length](#length) [mediaText](#mediatext)

### Methods[](#methods)

[\[iterator\]](#iterator) [appendMedium](#appendmedium) [deleteMedium](#deletemedium) [item](#item) [toString](#tostring)

## Properties[](#properties-1)

### `Readonly`length[](#length)

length: number

The read-only **`length`** property of the MediaList interface returns the number of media queries in the list.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaList/length)

### mediaText[](#mediatext)

mediaText: string

The **`mediaText`** property of the MediaList interface is a stringifier that returns a string representing the MediaList as text, and also allows you to set a new MediaList.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaList/mediaText)

## Methods[](#methods-1)

### \[iterator\][](#iterator)

-   "\[iterator\]"(): [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<string\>[](#iterator-1)
    
    #### Returns [ArrayIterator](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.ArrayIterator/)<string\>
    

### appendMedium[](#appendmedium)

-   appendMedium(medium: string): void[](#appendmedium-1)
    
    The **`appendMedium()`** method of the MediaList interface adds a media query to the list. If the media query is already in the collection, this method does nothing.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaList/appendMedium)
    
    #### Parameters
    
    -   medium: string
    
    #### Returns void
    

### deleteMedium[](#deletemedium)

-   deleteMedium(medium: string): void[](#deletemedium-1)
    
    The **`deleteMedium()`** method of the MediaList interface removes from this MediaList the given media query.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaList/deleteMedium)
    
    #### Parameters
    
    -   medium: string
    
    #### Returns void
    

### item[](#item)

-   item(index: number): string | null[](#item-1)
    
    The **`item()`** method of the MediaList interface returns the media query at the specified index, or null if the specified index doesn't exist.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/MediaList/item)
    
    #### Parameters
    
    -   index: number
    
    #### Returns string | null
    

### toString[](#tostring)

-   toString(): string[](#tostring-1)
    
    #### Returns string
