# media-query-matcher

> Detect if media queries are applied on the page by using the native matchMedia API.

Latest version **1.0.0** (published 2015-07-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install media-query-matcher
pnpm add media-query-matcher
yarn add media-query-matcher
bun add media-query-matcher
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-07-01 |
| First published | 2015-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Primal Skill |
| Maintainers | primalskill |
| Keywords | media, query, match, matcher |

## Links

- npm: https://www.npmjs.com/package/media-query-matcher
- Repository: https://github.com/primalskill/media-query-matcher
- Issues: https://github.com/primalskill/media-query-matcher/issues
- npm.io page: https://npm.io/package/media-query-matcher

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-07-01

## README

Use the native matchMedia API to detect if a specific media query applies on the page.

## Browser Support

* IE 10+
* Firefox
* Chrome
* Safari

## Installation

```sh
npm install media-query-matcher --save
```

## Example

```js
var MediaQueryMatcher = require('media-query-matcher');

var mqMatcher = new MediaQueryMatcher({
	'phone': 'only screen and (min-width: 480px)',
	'tablet': 'only screen and (min-width: 768px)'
});

console.log('phone: ', mqMatcher.is('phone') );
console.log('tablet: ', mqMatcher.is('tablet') );

mqMatcher.on('phone', function() {
	console.log('on phone: true');
});

mqMatcher.on('tablet', function() {
	console.log('on tablet: true');
});
```

A more comprehensive example is available by running:

```sh
npm run demo
```

---
_Source: https://npm.io/package/media-query-matcher · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
