Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

keybinder

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keybinder

Javascript keybinder

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

keybinder - Simple Javascript Keybinder


Installation

npm i keybinder --save

To Use

keybinder(selector, keys, callback);

The arguments for the keybinder are:

  • Selector (String): The DOM selector for elements that you want to bind the keys to.

  • keys (Array): Array of key combinations to listen to.

  • callback (function): The callback function to run when the specified key combinations are pressed. This is automatically bound to the element selected.

Sample Code:

<input type="text" class="name" />
<script src="path/to/keybinder.js" charset="utf-8"></script>
<script type="text/javascript">
    keybinder('.name', ['control', 's'], function () {
      // this refers to element with .name as class
      this.value = 'I am changed';
    });
</script>

Contributing

Is there something you think it is missing? Great!

  • Fork this repo
  • Make changes, write tests
  • Send a pull request

License

Keybinder is licensed under the MIT License

Keywords

FAQs

Package last updated on 09 Nov 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc