Socket
Socket
Sign inDemoInstall

keycon

Package Overview
Dependencies
5
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    keycon

Keyboard Controller


Version published
Weekly downloads
58K
increased by18.1%
Maintainers
1
Install size
1.07 MB
Created
Weekly downloads
 

Changelog

Source

1.4.0 (2022-12-04)

:sparkles: Packages

  • keycon 1.4.0
  • react-keycon 0.3.0
  • svelte-keycon 0.2.0
  • vue-keycon 0.2.0
  • vue2-keycon 0.2.0

:rocket: New Features

:mega: Other

  • All

Readme

Source

keycon npm version

Keyboard Controller

Installation

npm i keycon
<script src="https://daybrush.com/keycon/release/latest/dist/keycon.min.js"></script>

How to use

import KeyController, { getCombi, getKey } from "keycon";

const keycon = new KeyController();

// The focus went out of the browser.
keycon.on("blur", () => {
    console.log("blur");
});
// keydown all
keycon.keydown(e => {
    console.log(e);
});
// keydown space
keycon.keydown("space", e => {
    console.log(e);
});
// keydown alt + space combination
keycon.keydown(["alt", "space"], e => {
    // ["alt", "space"]
    console.log(getCombi(e));
    // "space"
    console.log(getKey(e.keyCode));

    console.log(e);
});

// keyup all
keycon.keyup(e => {
    console.log(e);
});
// keyup space
keycon.keydown("space", e => {
    console.log(e);
});
// keyup alt + space combination
keycon.keyup(["alt", "space"], e => {
    console.log(e);
});

Keywords

FAQs

Last updated on 04 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc