How to use the hotkeys-js.setScope 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 uiwjs / uiw / src / hotkeys / Hotkeys.js View on Github external
Hotkeys.filter = function (event) {
  const tagName = (event.target || event.srcElement).tagName;
  Hotkeys.setScope(/^(INPUT|TEXTAREA|SELECT)$/.test(tagName) ? 'input' : 'other');
  return true;
};
export default class ReactHotkeys extends Component {
github fjordllc / bootcamp / app / javascript / shortcut.js View on Github external
hotkeys.filter = function (event) {
  var tagName = (event.target || event.srcElement).tagName
  hotkeys.setScope(
    /^(INPUT|TEXTAREA|SELECT)$/.test(tagName) ? 'input' : 'other'
  )
  return true
}
github jaames / flipnote-player / src / components / FlipnotePlayer / index.jsx View on Github external
case 'left':
        case 'a':
          if (player.paused) player.prevFrame();
          break;
        case 'shift+right':
        case 'shift+d':
          if (player.paused) player.lastFrame();
          break;
        case 'shift+left':
        case 'shift+a':
          if (player.paused) player.firstFrame();
          break;
      }
      return false;
    });
    hotkeys.setScope('player');

    return () => {
      hotkeys.deleteScope('player');
      window.removeEventListener('resize', resizeCanvas);
      player.clearEvents();
      player.close();
      player.destroy();
    };
  }, []);

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