Skip to content

Commit

Permalink
released v3.4.0 #44
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Nov 21, 2018
1 parent fe2dd3c commit 50c8457
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
12 changes: 10 additions & 2 deletions dist/hotkeys.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* hotkeys-js v3.3.8
* hotkeys-js v3.4.0
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
*
* Copyright (c) 2018 kenny wong <wowohoo@qq.com>
Expand Down Expand Up @@ -208,11 +208,17 @@ function clearModifier(event) {
}

// 解除绑定某个范围的快捷键
function unbind(key, scope) {
function unbind(key, scope, method) {
var multipleKeys = getKeys(key);
var keys = void 0;
var mods = [];
var obj = void 0;
// 通过函数判断,是否解除绑定
// https://github.com/jaywcjlove/hotkeys/issues/44
if (typeof scope === 'function') {
method = scope;
scope = 'all';
}

for (var i = 0; i < multipleKeys.length; i++) {
// 将组合快捷键拆分为数组
Expand All @@ -235,6 +241,8 @@ function unbind(key, scope) {
// 让触发快捷键键之后没有事件执行到达解除快捷键绑定的目的
for (var r = 0; r < _handlers[key].length; r++) {
obj = _handlers[key][r];
// 通过函数判断,是否解除绑定,函数相等直接返回
if (method && obj.method !== method) return;
// 判断是否在范围内并且键值相同
if (obj.scope === scope && compareArray(obj.mods, mods)) {
_handlers[key][r] = {};
Expand Down
4 changes: 2 additions & 2 deletions dist/hotkeys.common.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions dist/hotkeys.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* hotkeys-js v3.3.8
* hotkeys-js v3.4.0
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
*
* Copyright (c) 2018 kenny wong <wowohoo@qq.com>
Expand Down Expand Up @@ -206,11 +206,17 @@ function clearModifier(event) {
}

// 解除绑定某个范围的快捷键
function unbind(key, scope) {
function unbind(key, scope, method) {
var multipleKeys = getKeys(key);
var keys = void 0;
var mods = [];
var obj = void 0;
// 通过函数判断,是否解除绑定
// https://github.com/jaywcjlove/hotkeys/issues/44
if (typeof scope === 'function') {
method = scope;
scope = 'all';
}

for (var i = 0; i < multipleKeys.length; i++) {
// 将组合快捷键拆分为数组
Expand All @@ -233,6 +239,8 @@ function unbind(key, scope) {
// 让触发快捷键键之后没有事件执行到达解除快捷键绑定的目的
for (var r = 0; r < _handlers[key].length; r++) {
obj = _handlers[key][r];
// 通过函数判断,是否解除绑定,函数相等直接返回
if (method && obj.method !== method) return;
// 判断是否在范围内并且键值相同
if (obj.scope === scope && compareArray(obj.mods, mods)) {
_handlers[key][r] = {};
Expand Down
12 changes: 10 additions & 2 deletions dist/hotkeys.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* hotkeys-js v3.3.8
* hotkeys-js v3.4.0
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
*
* Copyright (c) 2018 kenny wong <wowohoo@qq.com>
Expand Down Expand Up @@ -212,11 +212,17 @@
}

// 解除绑定某个范围的快捷键
function unbind(key, scope) {
function unbind(key, scope, method) {
var multipleKeys = getKeys(key);
var keys = void 0;
var mods = [];
var obj = void 0;
// 通过函数判断,是否解除绑定
// https://github.com/jaywcjlove/hotkeys/issues/44
if (typeof scope === 'function') {
method = scope;
scope = 'all';
}

for (var i = 0; i < multipleKeys.length; i++) {
// 将组合快捷键拆分为数组
Expand All @@ -239,6 +245,8 @@
// 让触发快捷键键之后没有事件执行到达解除快捷键绑定的目的
for (var r = 0; r < _handlers[key].length; r++) {
obj = _handlers[key][r];
// 通过函数判断,是否解除绑定,函数相等直接返回
if (method && obj.method !== method) return;
// 判断是否在范围内并且键值相同
if (obj.scope === scope && compareArray(obj.mods, mods)) {
_handlers[key][r] = {};
Expand Down
Loading

0 comments on commit 50c8457

Please sign in to comment.