MCPcopy Index your code
hub / github.com/philc/vimium / init

Method init

content_scripts/mode_key_handler.js:36–58  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

34 }
35
36 init(options) {
37 const args = Object.assign(options, { keydown: this.onKeydown.bind(this) });
38 super.init(args);
39
40 this.commandHandler = options.commandHandler || (function () {});
41 this.setKeyMapping(options.keyMapping || {});
42
43 if (options.exitOnEscape) {
44 // If we're part way through a command's key sequence, then a first Escape should reset the
45 // key state, and only a second Escape should actually exit this mode.
46 this.push({
47 _name: "key-handler-escape-listener",
48 keydown: (event) => {
49 if (KeyboardUtils.isEscape(event) && !this.isInResetState()) {
50 this.reset();
51 return this.suppressEvent;
52 } else {
53 return this.continueBubbling;
54 }
55 },
56 });
57 }
58 }
59
60 onKeydown(event) {
61 const keyChar = KeyboardUtils.getKeyCharString(event);

Callers

nothing calls this directly

Calls 4

setKeyMappingMethod · 0.95
isInResetStateMethod · 0.95
resetMethod · 0.95
pushMethod · 0.45

Tested by

no test coverage detected