New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

elm-keyboard-shortcut

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elm-keyboard-shortcut - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "elm-keyboard-shortcut",
"version": "1.0.0",
"version": "1.0.1",
"description": "companion package for elm-keyboard-shortcut",

@@ -5,0 +5,0 @@ "main": "src/shortcut-element.js",

# elm-keyboard-shortcut
![GitHub Page example](https://github.com/leojpod/elm-keyboard-shortcut/workflows/GitHub%20Page%20example/badge.svg?branch=master)
## Why?

@@ -4,0 +6,0 @@

import '@webcomponents/custom-elements'
import deburr from 'lodash.deburr'
let preventDuplicateEvent = false
/**
* make sure the given fct is ran at most once every 10ms
**/
function dedup (fct, event) {
// if the lock it not in place
if (!preventDuplicateEvent) {
// then run the thing
// but first put the lock in place
preventDuplicateEvent = true
setTimeout(() => {
preventDuplicateEvent = false
}, 10)
return fct(event)
} // else ignore it
}
/**
* will process each incoming keydown event and try to match them to the list given in the shortcut attribute

@@ -26,10 +9,6 @@ **/

connectedCallback () {
console.log('hello', this)
// when the element is created: add some listeners to the body
// we'll take them out when it's all over
this.listener = (evt) => {
console.log('undedup evt -> ', evt, this.shortcuts)
// dedup((event) => {
const event = evt
console.log("what we've got here is an event: ", event)
this.shortcuts

@@ -57,3 +36,2 @@ .filter(

})
// }, evt)
}

@@ -60,0 +38,0 @@ document.body.addEventListener('keydown', this.listener, { capture: true })

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