Socket
Socket
Sign inDemoInstall

atom-keymap

Package Overview
Dependencies
60
Maintainers
14
Versions
154
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    atom-keymap

Atom's DOM-aware keymap module


Version published
Weekly downloads
81
decreased by-76.72%
Maintainers
14
Created
Weekly downloads
 

Readme

Source

Atom keymap

Build Status Dependency Status

Atom's DOM-aware keymap module

var KeymapManager, keymaps;
KeymapManager = require('atom-keymap')

keymaps = new KeymapManager
keymaps.defaultTarget = document.body

// Pass all the window's keydown events to the KeymapManager
document.addEventListener('keydown', function(event) {
  keymaps.handleKeyboardEvent(event)
})

// Add some keymaps
keymaps.loadKeymap('/path/to/keymap-file.json') // can also be a directory of json / cson files
// OR
keymaps.add('/key/for/these/keymaps', {
  "body": {
    "up": "core:move-up",
    "down": "core:move-down"
  }
})

// When a keybinding is triggered, it will dispatch it on the node that was focused
window.addEventListener('core:move-up', (event) => console.log('up', event))
window.addEventListener('core:move-down', (event) => console.log('down', event))

Development

The tests for this module must be run in Electron because they depend on browser APIs.

  • devtool is bundled as a development dependency to run the tests.
  • Native modules need to be compiled against the version of Electron included with devtool. Be sure to run electron-rebuild be sure recompile native dependencies before running tests.
  • Tests can be run in batch mode with npm test
  • If you want to use the debugger, profiler, etc or just speed up your flow by being able to refresh the devtool window to re-run tests, use the npm run test-drive script. This will keep devtool open instead of exiting after the test run.

FAQs

Last updated on 07 Jul 2021

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