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

combokeys-context

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combokeys-context

Wrapper around Combokeys that provides support for context/scope.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

ComboKeys Context

Dependency Status Build Status Coverage Status

This is a light wrapper about ComboKeys that provides context aware key bindings.

Compatibility

Tested against the latest version of Google Chrome, latest Firefox, and Internet Explorer 10 and 11. Should work with all browsers that works with ComboKeys as long as Object.keys is polyfilled where needed.

Documentation

Full Usage

var ComboKeys = require('combokeys');
var ComboKeysContext = require('combokeys-context');

var comboKeys = new ComboKeys(document);
var comboKeysContext = new ComboKeysContext(comboKeys);

// define callbacks
var callbackGlobal = function(evt, key) {
	// `this` is a reference to comboKeys
	console.log('Global: ' + key);
}
var callbackContext = function(evt, key) {
	console.log('Context A: ' + key);
}

// bind in the global context
comboKeysContext.bind('alt+a', callback);
comboKeysContext.bind('alt+b', callback);

// bind into a context
comboKeysContext.bind('alt+b', 'contextA', callback);

// alt-a press would result in Global: alt+a
// alt-b press would result in Global: alt+b

comboKeysContext.switchContext('contextA');
// alt-a press would result in Global: alt+a
// alt-b press would result in Context A: alt+b

// return to global only state
comboKeysContext.clearContext();

// unbind the global, leaving contextA along
comboKeysContext.unbind('alt+b');
// unbind contextA
comboKeysContext.unbind('alt+b', 'contextA');
// unbind all will remove global and all context bindings
comboKeysContext.unbindAll('alt+b');

// reset will remove all bindings, will also reset ComboKeys
comboKeysContext.reset();

Full API Docs

ComboKeys Context JSDocs

##License

Combokeys Context is released under the MIT license. See LICENSE.

Keywords

FAQs

Package last updated on 08 Mar 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc