W3cubDocs

/Haxe JavaScript

MediaQueryList

package js.html

extends EventTarget

Available on js

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 also:

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

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/MediaQueryList.html