The MediaQueryListEvent() constructor creates a new MediaQueryListEvent object.
new MediaQueryListEvent(type)
new MediaQueryListEvent(type, options)typeA string with the name of the event. It is case-sensitive and browsers always set it to change.
options OptionalAn object that, in addition of the properties defined in Event(), can have the following properties:
media OptionalA string representing a serialized media query. It defaults to "".
matches OptionalA boolean value representing the media query status; true if it matches, false if not. It defaults to false.
A new MediaQueryListEvent object.
const media = "(width <= 600px)";
const matches = true;
const myMediaQueryListEvent = new MediaQueryListEvent("change", {
media,
matches,
});