# bind-mousetrap-global

> A version of mousetrap-global-bind in an easy-to-use module

Latest version **1.0.1** (published 2021-05-02) · 0BSD license · 0 weekly downloads

## Install

```sh
npm install bind-mousetrap-global
pnpm add bind-mousetrap-global
yarn add bind-mousetrap-global
bun add bind-mousetrap-global
```

## 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.1 |
| Published | 2021-05-02 |
| First published | 2021-05-02 |
| Weekly downloads | 0 |
| License | 0BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Adam Soutar |
| Maintainers | deebo |

## Links

- npm: https://www.npmjs.com/package/bind-mousetrap-global
- Repository: https://github.com/adamsoutar/bind-mousetrap-global
- Homepage: https://github.com/adamsoutar/bind-mousetrap-global#readme
- Issues: https://github.com/adamsoutar/bind-mousetrap-global/issues
- npm.io page: https://npm.io/package/bind-mousetrap-global

## Recent versions

- 1.0.1 (latest) — 2021-05-02
- 1.0.0 — 2021-05-02

## README

# 🪤 bind-mousetrap-global

A [mousetrap-global-bind](https://github.com/Elvynia/mousetrap-global-bind/blob/master/mousetrap-global-bind.js) module that doesn't assume the presence of a global object.

Perfect for use in a module environment like create-react-app as opposed to a `<script />` tag approach.


```bash
npm i bind-mousetrap-global
```

## Usage

**Setup**

```js
import mousetrap from 'mousetrap'
import addGlobalBinds from 'bind-mousetrap-global'

addGlobalBinds(mousetrap)
```

**Use**

```js
// This shortcut will fire even if the user has an input focused
mousetrap.bindGlobal('mod+s', saveDocument)
// This one won't
mousetrap.bind('n', newDocument)
```

## License note

This is a rewrite inspired by similar packages from [ccampbell](https://github.com/ccampbell/mousetrap/tree/master/plugins/global-bind) and [Elvynia](https://github.com/Elvynia/mousetrap-global-bind). It does not contain any of their code.

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