src/_helpers/hotkeys.js
File hotkeys.js
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*!
* hotkeys-js v3.3.8
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
*
* Copyright (c) 2018 kenny wong <wowohoo@qq.com>
Function hotkeys
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function hotkeys(key, option, method, data) {
var keys = getKeys(key); // List of shortcut keys to process
var mods = [];
var scope = 'all'; // Scope defaults to all, all ranges are valid
var element = document; // Shortcut event binding node
Consider simplifying this complex logical expression. Open
Open
if (handler.mods.length === 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91] || modifiersMatch || handler.shortcut === '*') {
// Call the handler, if it is a modifier key, it will not be processed.
if (handler.method(event, handler) === false) {
if (event.preventDefault) event.preventDefault(); else event.returnValue = false;
if (event.stopPropagation) event.stopPropagation();