Move hotkey listener from anonymous to named function.
This commit is contained in:
		
							parent
							
								
									48a63a099b
								
							
						
					
					
						commit
						90873c648b
					
				
					 1 changed files with 12 additions and 12 deletions
				
			
		|  | @ -57,19 +57,19 @@ function show_all_hotkeys() | ||||||
|     alert(lines); |     alert(lines); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| window.addEventListener( | hotkeys.hotkeys_listener = | ||||||
|     "keydown", | function hotkeys_listener(event) | ||||||
|     function(event) | { | ||||||
|  |     if (hotkeys.should_prevent_hotkey(event)) { return; } | ||||||
|  |     identifier = hotkeys.hotkey_identifier(event.key, event.ctrlKey, event.shiftKey, event.altKey); | ||||||
|  |     console.log(identifier); | ||||||
|  |     if (identifier in hotkeys.HOTKEYS) | ||||||
|     { |     { | ||||||
|         if (hotkeys.should_prevent_hotkey(event)) { return; } |         hotkeys.HOTKEYS[identifier]["action"](); | ||||||
|         identifier = hotkeys.hotkey_identifier(event.key, event.ctrlKey, event.shiftKey, event.altKey); |         event.preventDefault(); | ||||||
|         console.log(identifier); |  | ||||||
|         if (identifier in hotkeys.HOTKEYS) |  | ||||||
|         { |  | ||||||
|             hotkeys.HOTKEYS[identifier]["action"](); |  | ||||||
|             event.preventDefault(); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| ); | } | ||||||
|  | 
 | ||||||
|  | window.addEventListener("keydown", hotkeys.hotkeys_listener); | ||||||
| 
 | 
 | ||||||
| hotkeys.register_hotkey("/", 0, 0, 0, hotkeys.show_all_hotkeys, "Show hotkeys."); | hotkeys.register_hotkey("/", 0, 0, 0, hotkeys.show_all_hotkeys, "Show hotkeys."); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue