Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/evt/lib/index.ts>dom.MediaQueryList

💧EventEmitter's typesafe replacement
Go to Latest
interface dom.MediaQueryList
implements EventTarget
import { type dom } from "https://deno.land/x/evt@v2.4.17/lib/index.ts";
const { MediaQueryList } = dom;

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).

Properties

readonly
matches: boolean
readonly
media: string
onchange: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null

Methods

deprecated
addListener(listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null): void
deprecated
removeListener(listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null): void
addEventListener<K extends keyof MediaQueryListEventMap>(
type: K,
listener: (this: MediaQueryList, ev: MediaQueryListEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof MediaQueryListEventMap>(
type: K,
listener: (this: MediaQueryList, ev: MediaQueryListEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void