A MediaQueryList object stores information on a media query applied to a document, and handles sending notifications to listeners when the media query state change (i.e. when the media query test starts or stops evaluating to true).

Documentation MediaQueryList by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Variables

read onlymatches:Bool

 A Boolean that returns true if the document currently matches the media query list, or false if not.

read onlymedia:String

 A DOMString representing a serialized media query.

onchange:Function

 An event handler property representing a function that is invoked when the change event fires, i.e when the status of media query support changes. The event object is a MediaQueryListEvent instance, which is recognised as a MediaListQuery instance in older browsers, for backwards compatibility purposes.

Methods

addListener (listener:Event ‑> Void):Void

addListener (listener:Function):Void

addListener (listener:EventListener):Void

 Adds a listener to the MediaQueryListener that will run a custom callback function in response to the media query status changing. This is basically an alias for EventTarget.addEventListener(), for backwards compatibility purposes.

Throws:

null

DOMError

removeListener (listener:Event ‑> Void):Void

removeListener (listener:Function):Void

removeListener (listener:EventListener):Void

 Removes a listener from the MediaQueryListener. This is basically an alias for EventTarget.removeEventListener(), for backwards compatibility purposes.

Throws:

null

DOMError

Inherited Variables

Inherited Methods

Defined by EventTarget

addEventListener (type:String, listener:Function, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

addEventListener (type:String, listener:EventListener, ?options:EitherType<AddEventListenerOptions, Bool>, ?wantsUntrusted:Bool):Void

Register an event handler of a specific event type on the EventTarget.

Throws:

null

DOMError

dispatchEvent (event:Event):Bool

Dispatch an event to this EventTarget.

Throws:

null

DOMError

removeEventListener (type:String, listener:Function, ?options:EitherType<EventListenerOptions, Bool>):Void

removeEventListener (type:String, listener:EventListener, ?options:EitherType<EventListenerOptions, Bool>):Void

Removes an event listener from the EventTarget.

Throws:

null

DOMError