# @gomarky/window-shortcut

> Register shortcuts

Latest version **1.0.40** (published 2025-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gomarky/window-shortcut
pnpm add @gomarky/window-shortcut
yarn add @gomarky/window-shortcut
bun add @gomarky/window-shortcut
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.40 |
| Published | 2025-07-21 |
| First published | 2022-02-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrew Slesarenko |
| Maintainers | teodor_dre |
| Keywords | key, shortcuts |

## Links

- npm: https://www.npmjs.com/package/@gomarky/window-shortcut
- Repository: https://github.com/GoMarky/window-shortcut
- Homepage: https://github.com/GoMarky/window-shortcut.git#readme
- Issues: https://github.com/GoMarky/window-shortcut.git/issues
- npm.io page: https://npm.io/package/@gomarky/window-shortcut

## Dependencies (2)

- [@babel/core](https://npm.io/package/@babel/core.md) ^7.17.5
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.13.15

## Recent versions

- 1.0.40 (latest) — 2025-07-21
- 1.0.39 — 2025-07-21
- 1.0.38 — 2025-07-21
- 1.0.37 — 2025-03-06
- 1.0.36 — 2025-03-06
- 1.0.35 — 2025-03-05
- 1.0.34 — 2025-03-05
- 1.0.32 — 2025-03-05
- 1.0.31 — 2025-03-05
- 1.0.30 — 2025-03-04
- 1.0.29 — 2022-11-05
- 1.0.28 — 2022-10-24
- 1.0.27 — 2022-10-24
- 1.0.25 — 2022-10-24
- 1.0.23 — 2022-10-24
- … 15 more at https://npm.io/package/@gomarky/window-shortcut/versions

## README

# @gomarky/window-shortcut

---

## :cd: Installation

* via pnpm `pnpm add @gomarky/window-shortcut`
* via npm: `npm install @gomarky/window-shortcut --save`
* via yarn: `yarn add @gomarky/window-shortcut`

## :notebook: List of available shortcuts

```javascript
'Ctrl+D',
'Meta+D',
'Ctrl+O',
'Meta+O',
'Ctrl+P',
'Meta+P',
'Ctrl+X',
'Meta+X',
'Ctrl+Y',
'Meta+Y',
'Ctrl+J',
'Meta+J',
'Ctrl+U',
'Meta+U',
'Ctrl+I',
'Meta+I',
'Meta+Q',
'Ctrl+Q',
'Meta+E',
'Ctrl+E',
'Ctrl+B',
'Meta+B',
'Ctrl+P',
'Meta+P',
'Ctrl+N',
'Meta+N',
'Ctrl+T',
'Meta+T',
'Ctrl+F',
'Meta+F',
'Meta+A',
'Ctrl+A',
'Meta+C',
'Ctrl+C',
'Meta+V',
'Ctrl+V',
'Meta+Z',
'Ctrl+Z',
'Ctrl+W',
'Meta+W',
'Meta+S',
'Ctrl+S',
'Ctrl+Shift+A',
'Meta+Shift+A',
'Ctrl+Shift+D',
'Meta+Shift+D',
'Ctrl+Shift+Z',
'Meta+Shift+Z',
'Shift+Tab',
'Tab'
```

## :rocket: Usage

```javascript
import WindowShortcut from '@gomarky/window-shortcut'

const instance = new WindowShortcut();

instance.registerShortcut('Ctrl+A', (event: KeyboardEvent) => {
  console.log('Ctrl+A pressed');
})

instance.registerShortcut('Shift+B', (event: KeyboardEvent) => {
  // prevent default browser behaviour
  event.preventDefault();
  
  console.log('Shift+B pressed');
});

// when disposed, u cant use it anymore
instance.dispose();
```

## :warning:

> ⚠️ By default, at every shortcut execution, we DO NOT prevent default behaviour of browser.
> Make sure, that you call `event.preventDefault()` if needed.
> ⚠️ Note: Available only on desktop devices. Mobile browsers/devices is not support. (Due they don't have keyboards =))
---

## 🔓 License

See the [LICENSE](LICENSE) file for license rights and limitations (MIT).

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