-
-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6ad954
commit bced404
Showing
7 changed files
with
55 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
/*! | ||
* hotkeys-js v3.8.7 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
/**! | ||
* hotkeys-js v3.8.8 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
* | ||
* Copyright (c) 2022 kenny wong <[email protected]> | ||
* http://jaywcjlove.github.io/hotkeys | ||
* | ||
* Licensed under the MIT license. | ||
* Copyright (c) 2022 kenny wong <[email protected]> | ||
* http://jaywcjlove.github.io/hotkeys | ||
* Licensed under the MIT license | ||
*/ | ||
|
||
'use strict'; | ||
|
@@ -157,6 +156,8 @@ for (var k = 1; k < 20; k++) { | |
|
||
var _downKeys = []; // 记录摁下的绑定键 | ||
|
||
var winListendFocus = false; // window是否已经监听了focus事件 | ||
|
||
var _scope = 'all'; // 默认热键范围 | ||
|
||
var elementHasBindEvent = []; // 已绑定事件的节点记录 | ||
|
@@ -526,9 +527,14 @@ function hotkeys(key, option, method) { | |
addEvent(element, 'keydown', function (e) { | ||
dispatch(e); | ||
}); | ||
addEvent(window, 'focus', function () { | ||
_downKeys = []; | ||
}); | ||
|
||
if (!winListendFocus) { | ||
winListendFocus = true; | ||
addEvent(window, 'focus', function () { | ||
_downKeys = []; | ||
}); | ||
} | ||
|
||
addEvent(element, 'keyup', function (e) { | ||
dispatch(e); | ||
clearModifier(e); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
/*! | ||
* hotkeys-js v3.8.7 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
/**! | ||
* hotkeys-js v3.8.8 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
* | ||
* Copyright (c) 2022 kenny wong <[email protected]> | ||
* http://jaywcjlove.github.io/hotkeys | ||
* | ||
* Licensed under the MIT license. | ||
* Copyright (c) 2022 kenny wong <[email protected]> | ||
* http://jaywcjlove.github.io/hotkeys | ||
* Licensed under the MIT license | ||
*/ | ||
|
||
var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件 | ||
|
@@ -155,6 +154,8 @@ for (var k = 1; k < 20; k++) { | |
|
||
var _downKeys = []; // 记录摁下的绑定键 | ||
|
||
var winListendFocus = false; // window是否已经监听了focus事件 | ||
|
||
var _scope = 'all'; // 默认热键范围 | ||
|
||
var elementHasBindEvent = []; // 已绑定事件的节点记录 | ||
|
@@ -524,9 +525,14 @@ function hotkeys(key, option, method) { | |
addEvent(element, 'keydown', function (e) { | ||
dispatch(e); | ||
}); | ||
addEvent(window, 'focus', function () { | ||
_downKeys = []; | ||
}); | ||
|
||
if (!winListendFocus) { | ||
winListendFocus = true; | ||
addEvent(window, 'focus', function () { | ||
_downKeys = []; | ||
}); | ||
} | ||
|
||
addEvent(element, 'keyup', function (e) { | ||
dispatch(e); | ||
clearModifier(e); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
/*! | ||
* hotkeys-js v3.8.7 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
/**! | ||
* hotkeys-js v3.8.8 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
* | ||
* Copyright (c) 2022 kenny wong <[email protected]> | ||
* http://jaywcjlove.github.io/hotkeys | ||
* | ||
* Licensed under the MIT license. | ||
* Copyright (c) 2022 kenny wong <[email protected]> | ||
* http://jaywcjlove.github.io/hotkeys | ||
* Licensed under the MIT license | ||
*/ | ||
|
||
(function (global, factory) { | ||
|
@@ -161,6 +160,8 @@ | |
|
||
var _downKeys = []; // 记录摁下的绑定键 | ||
|
||
var winListendFocus = false; // window是否已经监听了focus事件 | ||
|
||
var _scope = 'all'; // 默认热键范围 | ||
|
||
var elementHasBindEvent = []; // 已绑定事件的节点记录 | ||
|
@@ -530,9 +531,14 @@ | |
addEvent(element, 'keydown', function (e) { | ||
dispatch(e); | ||
}); | ||
addEvent(window, 'focus', function () { | ||
_downKeys = []; | ||
}); | ||
|
||
if (!winListendFocus) { | ||
winListendFocus = true; | ||
addEvent(window, 'focus', function () { | ||
_downKeys = []; | ||
}); | ||
} | ||
|
||
addEvent(element, 'keyup', function (e) { | ||
dispatch(e); | ||
clearModifier(e); | ||
|
Oops, something went wrong.