(key, map, handle, context)
| 100 | } |
| 101 | |
| 102 | export function lookupKey(key, map, handle, context) { |
| 103 | map = getKeyMap(map) |
| 104 | let found = map.call ? map.call(key, context) : map[key] |
| 105 | if (found === false) return "nothing" |
| 106 | if (found === "...") return "multi" |
| 107 | if (found != null && handle(found)) return "handled" |
| 108 | |
| 109 | if (map.fallthrough) { |
| 110 | if (Object.prototype.toString.call(map.fallthrough) != "[object Array]") |
| 111 | return lookupKey(key, map.fallthrough, handle, context) |
| 112 | for (let i = 0; i < map.fallthrough.length; i++) { |
| 113 | let result = lookupKey(key, map.fallthrough[i], handle, context) |
| 114 | if (result) return result |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | // Modifier key presses don't count as 'real' key presses for the |
| 120 | // purpose of keymap fallthrough. |
no test coverage detected