How to use the hotkeys-js.shift function in hotkeys-js

To help you get started, we’ve selected a few hotkeys-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleChromeLabs / ProjectVisBug / app / components / hotkey-map / base.element.js View on Github external
watchKeys(e, handler) {
    e.preventDefault()
    e.stopImmediatePropagation()

    this.$shift.attr('pressed', hotkeys.shift)
    this.$alt.attr('pressed', hotkeys[altKey === 'opt' ? 'alt' : altKey])
    this.$cmd.attr('pressed', hotkeys[metaKey])
    this.$up.attr('pressed', e.code === 'ArrowUp')
    this.$down.attr('pressed', e.code === 'ArrowDown')
    this.$left.attr('pressed', e.code === 'ArrowLeft')
    this.$right.attr('pressed', e.code === 'ArrowRight')

    const { negative, negative_modifier, side, amount } = this.createCommand({e, hotkeys})

    $('[command]', this.$shadow)[0].innerHTML = this.displayCommand({
      negative, negative_modifier, side, amount,
    })
  }

hotkeys-js

A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.

MIT
Latest version published 10 months ago

Package Health Score

77 / 100
Full package analysis