Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone-hotkeys

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-hotkeys

#About **Backbone Hotkeys** is an extension to the standard Backbone View which lets you easily add and remove handlers for keyboard events supporting almost any key combination. Uses the *jquery.hotkey.js* library written by: [John Resig] (http://

  • 1.2.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Backbone-hotkeys

#About Backbone Hotkeys is an extension to the standard Backbone View which lets you easily add and remove handlers for keyboard events supporting almost any key combination. Uses the jquery.hotkey.js library written by: [John Resig] (http://github.com/jeresig/jquery.hotkeys).

Demo

Demo

Event Types

Supported types are 'keydown'and 'keyup'.

How-to

Include jquery.hotkeys.js and backbone-hotkeys.js after backbone.js in your app.

Example

App.SomeView = Backbone.View.extend({
  el: 'some-container',

  events: {
    'keyup[esc]       body': 'someMethod',
    'keyup[Alt+m]     body': 'someMethod',
    'keyup[Ctrl+left] body': 'someMethod'
  }

});

Notes

If a selector is defined on a hotkey event then it is used as a filter for the target function.

There are 4 arguments in the events binding, which are:

  • keyup: when key action should trigger the event
  • [esc]: the key (or key-combination, separated with +) to trigger the event
  • body: the DOM element this should bind to (ie. event must bubble up to this).
  • someMethod: The method to execute when a matching key combination is found (same as normal Backbone events).

Compatibility

Works with jQuery 1.8.3 and Backbone 1.1.2.

Revision History

  • 1.2 Added automatic event unbinding for events bound to document - see #4.
  • 1.10 Bound to document as default and added jQuery selector parameter as filter for target function.
  • 1.0 Initial release

License

MIT License

FAQs

Package last updated on 03 Nov 2016

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