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

atom-keymap

Package Overview
Dependencies
Maintainers
5
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atom-keymap - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

258

api.json

@@ -6,3 +6,3 @@ {

"filename": "src/keymap-manager.coffee",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L85",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L92",
"sections": [],

@@ -13,6 +13,53 @@ "classMethods": [

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L100",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L107",
"visibility": "Public",
"summary": "Create a keydown DOM event for testing purposes.",
"description": "Create a keydown DOM event for testing purposes.\n\nkey - The key or keyIdentifier of the event. For example, 'a', '1',\n 'escape', 'backspace', etc.\noptions - An {Object} containing any of the following:\n :ctrl - A {Boolean} indicating the ctrl modifier key\n :alt - A {Boolean} indicating the alt modifier key\n :shift - A {Boolean} indicating the shift modifier key\n :cmd - A {Boolean} indicating the cmd modifier key\n :which - A {Number} indicating `which` value of the event. See\n the docs for KeyboardEvent for more information.\n :target - The target element of the event. "
"description": "Create a keydown DOM event for testing purposes.",
"arguments": {
"description": "",
"list": [
{
"name": "key",
"description": "The key or keyIdentifier of the event. For example, 'a', '1', \n```\n 'escape', 'backspace', etc.\n```",
"type": null
},
{
"children": [
{
"name": "ctrl",
"description": "A {Boolean} indicating the ctrl modifier key",
"type": "Boolean"
},
{
"name": "alt",
"description": "A {Boolean} indicating the alt modifier key",
"type": "Boolean"
},
{
"name": "shift",
"description": "A {Boolean} indicating the shift modifier key",
"type": "Boolean"
},
{
"name": "cmd",
"description": "A {Boolean} indicating the cmd modifier key",
"type": "Boolean"
},
{
"name": "which",
"description": "A {Number} indicating `which` value of the event. See \n```\n the docs for KeyboardEvent for more information.\n```",
"type": "Number"
},
{
"name": "target",
"description": "The target element of the event. ",
"type": null
}
],
"name": null,
"description": "options An {Object} containing any of the following:",
"type": null
}
]
}
}

@@ -24,6 +71,23 @@ ],

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L118",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L125",
"visibility": "Public",
"summary": "",
"description": "\n\noptions - An {Object} containing properties to assign to the keymap: You can\n pass custom properties to be used by extension methods. The following\n properties are also supported:\n :defaultTarget - This will be used as the target of events whose target\n is `document.body` to allow for a catch-all element when nothing is\n focused "
"summary": "Create a new KeymapManager.",
"description": "Create a new KeymapManager.",
"arguments": {
"description": "",
"list": [
{
"children": [
{
"name": "defaultTarget",
"description": "This will be used as the target of events whose target \n```\n is `document.body` to allow for a catch-all element when\n nothing is focused. \n```",
"type": null
}
],
"name": "options",
"description": "An {Object} containing properties to assign to the keymap. You \n```\n can pass custom properties to be used by extension methods. The\n following properties are also supported:\n```",
"type": "Object"
}
]
}
},

@@ -33,3 +97,3 @@ {

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L126",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L133",
"visibility": "Public",

@@ -42,3 +106,3 @@ "summary": "Unwatch all watched paths. ",

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L133",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L141",
"visibility": "Public",

@@ -57,6 +121,21 @@ "summary": "Get all current key bindings.",

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L142",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L150",
"visibility": "Public",
"summary": "Add sets of key bindings grouped by CSS selector.",
"description": "Add sets of key bindings grouped by CSS selector.\n\nsource - A {String} (usually a path) uniquely identifying the given bindings\n so they can be removed later.\nbindings - An {Object} whose top-level keys point at sub-objects mapping\n keystroke patterns to commands. "
"description": "Add sets of key bindings grouped by CSS selector.",
"arguments": {
"description": "",
"list": [
{
"name": "source",
"description": "A {String} (usually a path) uniquely identifying the given bindings \n```\n so they can be removed later.\n```",
"type": "String"
},
{
"name": "bindings",
"description": "An {Object} whose top-level keys point at sub-objects mapping \n```\n keystroke patterns to commands. \n```",
"type": "Object"
}
]
}
},

@@ -66,6 +145,28 @@ {

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L165",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L175",
"visibility": "Public",
"summary": "Load the key bindings from the given path.",
"description": "Load the key bindings from the given path.\n\npath - A {String} containing a path to a file or a directory. If the path is\n a directory, all files inside it will be loaded.\noptions - An {Object} containing the following optional keys:\n :watch - If `true`, the keymap will also reload the file at the given path\n whenever it changes. This option cannot be used with directory paths. "
"description": "Load the key bindings from the given path.",
"arguments": {
"description": "",
"list": [
{
"name": "path",
"description": "A {String} containing a path to a file or a directory. If the path is \n```\n a directory, all files inside it will be loaded.\n```",
"type": "String"
},
{
"children": [
{
"name": "watch",
"description": "If `true`, the keymap will also reload the file at the given \n```\n path whenever it changes. This option cannot be used with\n directory paths. \n```",
"type": null
}
],
"name": "options",
"description": "An {Object} containing the following optional keys:",
"type": "Object"
}
]
}
},

@@ -75,3 +176,3 @@ {

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L180",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L192",
"visibility": "Public",

@@ -84,6 +185,16 @@ "summary": "Cause the keymap to reload the key bindings file at the given path\nwhenever it changes.",

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L190",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L204",
"visibility": "Public",
"summary": "Remove the key bindings added with {::add} or {::loadKeymap}.",
"description": "Remove the key bindings added with {::add} or {::loadKeymap}.\n\nsource - A {String} representing the `source` in a previous call to\n {::add} or the path in {::loadKeymap}. "
"description": "Remove the key bindings added with {::add} or {::loadKeymap}.",
"arguments": {
"description": "",
"list": [
{
"name": "source",
"description": "A {String} representing the `source` in a previous call to \n```\n {::add} or the path in {::loadKeymap}. \n```",
"type": "String"
}
]
}
},

@@ -93,3 +204,3 @@ {

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L212",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L227",
"visibility": "Public",

@@ -102,6 +213,39 @@ "summary": "Dispatch a custom event associated with the matching key binding for\nthe given `KeyboardEvent` if one can be found.",

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L289",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L307",
"visibility": "Public",
"summary": "Get the key bindings for a given command and optional target.",
"description": "Get the key bindings for a given command and optional target.\n\nparams - An {Object} whose keys constrain the binding search:\n :keystrokes - A {String} representing one or more keystrokes, such as\n 'ctrl-x ctrl-s'\n :command - A {String} representing the name of a command, such as\n 'editor:backspace'\n :target - An optional DOM element constraining the search. If this\n parameter is supplied, the call will only return bindings that can be\n invoked by a KeyboardEvent originating from the target element. "
"description": "Get the key bindings for a given command and optional target.",
"arguments": {
"description": "",
"list": [
{
"children": [
{
"name": "keystrokes",
"description": "A {String} representing one or more keystrokes, such as \n```\n 'ctrl-x ctrl-s'\n```",
"type": "String"
},
{
"name": "command",
"description": "A {String} representing the name of a command, such as \n```\n 'editor:backspace'\n```",
"type": "String"
},
{
"name": "target",
"description": "An optional DOM element constraining the search. If this \n```\n parameter is supplied, the call will only return bindings that\n can be invoked by a KeyboardEvent originating from the target\n element.\n```",
"type": null
}
],
"name": "params",
"description": "An {Object} whose keys constrain the binding search:",
"type": "Object"
}
]
},
"returnValues": [
{
"type": "Array",
"description": "Returns an {Array} of key bindings."
}
]
},

@@ -111,6 +255,16 @@ {

"sectionName": null,
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.3/src/keymap-manager.coffee#L460",
"srcUrl": "https://github.com/atom/atom-keymap/blob/v2.0.4/src/keymap-manager.coffee#L478",
"visibility": "Public",
"summary": "Translate a keydown event to a keystroke string.",
"description": "Translate a keydown event to a keystroke string.\n\nevent - A `KeyboardEvent` of type 'keydown'",
"description": "Translate a keydown event to a keystroke string.",
"arguments": {
"description": "",
"list": [
{
"name": "event",
"description": "A `KeyboardEvent` of type 'keydown'",
"type": null
}
]
},
"returnValues": [

@@ -128,63 +282,17 @@ {

"events": {
"description": "",
"description": "### matched\n\nEmitted when keystrokes match a binding.",
"list": [
{
"children": [
{
"name": null,
"description": "keystrokes - The keystroke {String} that matched the binding",
"type": null
},
{
"name": null,
"description": "binding - The {KeyBinding} that was used",
"type": null
},
{
"name": null,
"description": "keyboardEventTarget - The target element of the keyboard event",
"type": null
}
],
"name": "matched",
"description": "Emitted when keystrokes match a binding.",
"type": null
"name": "keystrokes",
"description": "The keystroke {String} that matched the binding",
"type": "String"
},
{
"children": [
{
"name": null,
"description": "keystrokes - The keystroke {String} that partially match some bindings",
"type": null
},
{
"name": null,
"description": "partiallyMatchedBindings - The {KeyBinding}s that partially matched",
"type": null
},
{
"name": null,
"description": "keyboardEventTarget - The target element of the keyboard event",
"type": null
}
],
"name": "matched-partially",
"description": "Emitted when keystrokes partially match one or more bindings.",
"type": null
"name": "binding",
"description": "The {KeyBinding} that was used",
"type": "KeyBinding"
},
{
"children": [
{
"name": null,
"description": "keystrokes - The keystroke {String} that matched no bindings",
"type": null
},
{
"name": null,
"description": "keyboardEventTarget - The target element of the keyboard event ",
"type": null
}
],
"name": "match-failed",
"description": "Emitted when keystrokes don't match any bindings.",
"name": "keyboardEventTarget",
"description": "The target element of the keyboard event",
"type": null

@@ -191,0 +299,0 @@ }

@@ -62,10 +62,9 @@ (function() {

KeymapManager.prototype.destroy = function() {
var filePath, subscription, _ref1, _results;
var filePath, subscription, _ref1;
_ref1 = this.watchSubscriptions;
_results = [];
for (filePath in _ref1) {
subscription = _ref1[filePath];
_results.push(subscription.off());
subscription.off();
}
return _results;
return void 0;
};

@@ -98,27 +97,25 @@

}
return void 0;
};
KeymapManager.prototype.loadKeymap = function(bindingsPath, options) {
var checkIfDirectory, filePath, _i, _len, _ref1, _ref2, _results;
var checkIfDirectory, filePath, _i, _len, _ref1, _ref2;
checkIfDirectory = (_ref1 = options != null ? options.checkIfDirectory : void 0) != null ? _ref1 : true;
if (checkIfDirectory && fs.isDirectorySync(bindingsPath)) {
_ref2 = fs.listSync(bindingsPath, ['.cson', '.json']);
_results = [];
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
filePath = _ref2[_i];
if (this.filePathMatchesPlatform(filePath)) {
_results.push(this.loadKeymap(filePath, {
this.loadKeymap(filePath, {
checkIfDirectory: false
}));
} else {
_results.push(void 0);
});
}
}
return _results;
} else {
this.addKeymap(bindingsPath, this.readKeymap(bindingsPath, options != null ? options.suppressErrors : void 0));
if (options != null ? options.watch : void 0) {
return this.watchKeymap(bindingsPath);
this.watchKeymap(bindingsPath);
}
}
return void 0;
};

@@ -129,3 +126,3 @@

if (((_ref1 = this.watchSubscriptions[filePath]) != null ? _ref1.cancelled : void 0) !== false) {
return this.watchSubscriptions[filePath] = new File(filePath).on('contents-changed moved removed', (function(_this) {
this.watchSubscriptions[filePath] = new File(filePath).on('contents-changed moved removed', (function(_this) {
return function() {

@@ -136,8 +133,10 @@ return _this.reloadKeymap(filePath);

}
return void 0;
};
KeymapManager.prototype.remove = function(source) {
return this.keyBindings = this.keyBindings.filter(function(keyBinding) {
this.keyBindings = this.keyBindings.filter(function(keyBinding) {
return keyBinding.source !== source;
});
return void 0;
};

@@ -144,0 +143,0 @@

{
"name": "atom-keymap",
"version": "2.0.3",
"version": "2.0.4",
"description": "Atom's DOM-aware keymap module",

@@ -5,0 +5,0 @@ "main": "./lib/keymap-manager",

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