# @caofeilong/keybind

> > 改自 @hscmap/keybind 新家了 自定义dombinde 的方法

Latest version **0.1.0** (published 2019-08-17) · 0 weekly downloads

## Install

```sh
npm install @caofeilong/keybind
pnpm add @caofeilong/keybind
yarn add @caofeilong/keybind
bun add @caofeilong/keybind
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-08-17 |
| First published | 2019-08-17 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | caofeilong |

## Links

- npm: https://www.npmjs.com/package/@caofeilong/keybind
- Repository: https://github.com/michitaro/keybind
- Issues: https://github.com/michitaro/keybind/issues
- npm.io page: https://npm.io/package/@caofeilong/keybind

## Recent versions

- 0.1.0 (latest) — 2019-08-17

## README

> 改自 @hscmap/keybind 
新家了 自定义dombinde 的方法


# Keybind
This module provide a way for listening for key combination events with simple API.

# Example (Source of the working demo)

* [Working DEMO](http://michitaro.github.io/keybind)

```typescript
import * as keybind from "@hscmap/keybind"

window.addEventListener('load', () => {
    keybind.on('shift+x', () => alert('shift + X'))
    keybind.on('alt+x', () => alert('alt + X'))
    keybind.on('ctrl+x', () => alert('ctrl + X'))
    keybind.on('meta+x', () => alert('meta + X'))

    // can be triggered only once
    const off = keybind.on('shift+ctrl+x', () => {
        alert('shift + ctrl + X (triggered only once)')
        off()
    })

    const sources = ['shift+x', 'alt+x', 'ctrl+x', 'meta+x', 'shift+ctrl+x']
    for (const s of sources) {
        const html = keybind.html(s)
        const div = document.createElement('div')
        div.innerHTML = html
        document.body.appendChild(div)
    }
})
```

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