Socket
Socket
Sign inDemoInstall

backbone-shortcuts

Package Overview
Dependencies
3
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    backbone-shortcuts

Backbone.js + Keymaster.js = Backbone.Shortcuts


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
14.2 MB
Created
Weekly downloads
 

Readme

Source

Backbone.Shortcuts

Backbone.js + Keymaster.js = Backbone.Shortcuts.

Downloads

  • Development Version 1.031 kb, full source code
  • Production Version 0.577 kb, packed and gzipped

Dependencies

  • Underscore.js ~> 1.3.1 for _.extend() function
  • Backbone.js ~> 0.9.1 for Backbone class
  • Keymaster.js ~> 1.0.2 for keyboard shortcuts functionality

Usage

HTML

Place snippets inside of the <head>...</head> tags.

<script src="underscore.min.js"></script>
<script src="backbone.min.js"></script>
<script src="keymaster.min.js"></script>
<script src="backbone.shortcuts.min.js"></script>

JavaScript

var ShortcutKeys = Backbone.Shortcuts.extend({
  shortcuts: {
    "ctrl+r" : "reloadPage"
  },
  reloadPage: function() {
    alert("Reloaded!!");
  }
});

var shortcuts = new ShortcutKeys;

CoffeeScript

class ShortcutKeys extends Backbone.Shortcuts
  shortcuts:
    "ctrl+r" : "reloadPage"
  reloadPage: -> alert "Reload!!!"

shortcuts = new ShortcutKeys

Finally, you can press Ctrl + r to execute reloadPage() function to see the alert message.

Use Backbone.Shortcuts as Delegation for your Backbone.View

You have to _.extend the this as desination and new Backbone.Shortcuts as source then finally call the delegate function this.delegateShortcuts();.

See My jsFiddle Example

Author

Bryan Goines, @bryangoines

License

Backbone.Shortcuts is licensed under MIT license.

FAQs

Last updated on 23 Dec 2014

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