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

@discourse/itsatrap

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@discourse/itsatrap - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

43

itsatrap.js

@@ -20,4 +20,4 @@ /*global define:false */

*
* @version 1.6.5
* @url craig.is/killing/mice
* @version 2.0.1
* @url github.com/discourse/itsatrap
*/

@@ -1110,2 +1110,41 @@ (function(window, document, undefined) {

var _globalCallbacks = {};
var _originalStopCallback = ItsATrap.prototype.stopCallback;
ItsATrap.prototype.stopCallback = function(e, element, combo, sequence) {
var self = this;
if (self.paused) {
return true;
}
if (_globalCallbacks[combo] || _globalCallbacks[sequence]) {
return false;
}
return _originalStopCallback.call(self, e, element, combo);
};
/**
* adds a bindGlobal method to ItsATrap that allows you to
* bind specific keyboard shortcuts that will still work
* inside a text input field
*
* usage:
* ItsATrap.bindGlobal('ctrl+s', _saveChanges);
*/
ItsATrap.prototype.bindGlobal = function(keys, callback, action) {
var self = this;
self.bind(keys, callback, action);
if (keys instanceof Array) {
for (var i = 0; i < keys.length; i++) {
_globalCallbacks[keys[i]] = true;
}
return;
}
_globalCallbacks[keys] = true;
};
ItsATrap.init();

@@ -1112,0 +1151,0 @@

8

package.json
{
"name": "@discourse/itsatrap",
"version": "2.0.0",
"version": "2.0.1",
"description": "Fork of the original Mousetrap, Simple library for handling keyboard shortcuts",

@@ -10,4 +10,3 @@ "main": "itsatrap.js",

"scripts": {
"test": "mocha --reporter=nyan tests/test.itsatrap.js",
"build": "yarn run grunt --force "
"test": "mocha --reporter=nyan tests/test.itsatrap.js"
},

@@ -34,5 +33,4 @@ "repository": {

"mocha": "^5.2.0",
"sinon": "^7.2.2",
"grunt-cli": "^1.4.3"
"sinon": "^7.2.2"
}
}
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