# mqfunctions

> JavaScript library to manage matchMedia handlers.

Latest version **0.2.1** (published 2023-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install mqfunctions
pnpm add mqfunctions
yarn add mqfunctions
bun add mqfunctions
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2023-09-27 |
| First published | 2022-09-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 1 |
| Unpacked size | 39.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kimulaco |
| Maintainers | kimulaco |
| Keywords | media query, match media, mql |

## Links

- npm: https://www.npmjs.com/package/mqfunctions
- Repository: https://kimulaco@github.com/kimulaco/mqfunctions
- Homepage: https://github.com/kimulaco/mqfunctions
- Issues: https://github.com/kimulaco/mqfunctions/issues
- npm.io page: https://npm.io/package/mqfunctions

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.6.2

## 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

- 0.2.1 (latest) — 2023-09-27
- 0.1.0-alpha.4 (alpha) — 2022-09-30
- 0.2.0 — 2022-10-05
- 0.1.0 — 2022-09-30
- 0.1.0-alpha.3 — 2022-09-30
- 0.1.0-alpha.2 — 2022-09-30
- 0.1.0-alpha.1 — 2022-09-30

## README

# mqfunctions

[![Test Status](https://github.com/kimulaco/mqfunctions/workflows/Test/badge.svg)](https://github.com/kimulaco/mqfunctions/actions)
[![License MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![npm version](https://badge.fury.io/js/mqfunctions.svg)](https://badge.fury.io/js/mqfunctions)
[![codecov](https://codecov.io/gh/kimulaco/mqfunctions/branch/main/graph/badge.svg?token=OK88TDWT9B)](https://codecov.io/gh/kimulaco/mqfunctions)

JavaScript library to manage matchMedia handlers.

## Install

```bash
npm install mqfunctions
```

## Use

```js
import { createMqFunctions } from 'mqfunctions'

const mqf = createMqFunctions('(min-width: 768px)')

// Add matchMedia handler
mqf.add('function-01', (event) => {
  if (event.matches) {
    console.log('Resized window to PC size!')
  } else {
    console.log('Resized window to SP size!')
  }
})

// Run handler arbitrarily
mqf.run('function-01')

// Remove handler
mqf.remove('function-01')
```

## License

[MIT License](LICENSE).

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