@alessiofrittoli/web-utils
Version:
Common TypeScript web utilities
12 lines (10 loc) • 451 B
TypeScript
/**
* Safely executes `window.matchMedia()` in server and browser environments.
*
* @param query The Media Query string to check.
* @returns `false` if `window` is not defined or if the `document` currently doesn't matches the given `query`. `true` otherwise.
*
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/matches)
*/
declare const getMediaMatches: (query: string) => boolean;
export { getMediaMatches };