Socket
Socket
Sign inDemoInstall

shim-keyboard-event-key

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    shim-keyboard-event-key

Tiny KeyboardEvent#key shim for IE and MS Edge


Version published
Weekly downloads
13K
increased by11.28%
Maintainers
1
Install size
3.13 kB
Created
Weekly downloads
 

Readme

Source

shim-keyboard-event-key

Tiny KeyboardEvent#key shim for IE and MS Edge.

  • MS Edge bug report
  • Can I use key?
  • W3C: UI Events spec
  • W3C: key values

Up and running

Get the package from npm:

npm install shim-keyboard-event-key --save

And simply require the module:

import "shim-keyboard-event-key"

Otherwise, plug it the old-fashioned way:

<script src="https://unpkg.com/shim-keyboard-event-key" async></script>

Example

document.addEventListener("keyup", event => {
  if (event.defaultPrevented) return

  switch (event.key) {
    case "ArrowLeft":
    case "PageUp":
      player.prev()
      break

    case "ArrowRight":
    case "PageDown":
      player.next()
      break
  }
})

Keywords

FAQs

Last updated on 10 Mar 2019

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