#16 global variables checking for server-side render

pull/17/head
jaywcjlove 7 years ago
parent 85077bfee3
commit 1f93969dd4

@ -274,13 +274,14 @@ function getKeys(key) {
}
// 在全局document上设置快捷键
addEvent(document, 'keydown', function (event) {
dispatch(event);
});
addEvent(document, 'keyup', function (event) {
clearModifier(event);
});
if (typeof document !== 'undefined') {
addEvent(document, "keydown", function (event) {
dispatch(event);
});
addEvent(document, "keyup", function (event) {
clearModifier(event);
});
}
// 清除修饰键
function clearModifier(event) {
@ -347,17 +348,16 @@ _api = {
};
for (var a in _api) hotkeys[a] = _api[a];
var _hotkeys = window.hotkeys
hotkeys.noConflict = function (deep) {
if (deep && window.hotkeys === hotkeys) {
window.hotkeys = _hotkeys;
}
return hotkeys;
};
if (typeof window !== 'undefined') {
var _hotkeys = window.hotkeys;
hotkeys.noConflict = function (deep) {
if (deep && window.hotkeys === hotkeys) {
window.hotkeys = _hotkeys;
}
return hotkeys;
};
window.hotkeys = hotkeys;
}
window.hotkeys = hotkeys;
return hotkeys;

Loading…
Cancel
Save