(options)
| 1 | class NormalMode extends KeyHandlerMode { |
| 2 | init(options) { |
| 3 | if (options == null) { |
| 4 | options = {}; |
| 5 | } |
| 6 | |
| 7 | const defaults = { |
| 8 | name: "normal", |
| 9 | indicator: false, // There is normally no mode indicator in normal mode. |
| 10 | commandHandler: this.commandHandler.bind(this), |
| 11 | }; |
| 12 | |
| 13 | super.init(Object.assign(defaults, options)); |
| 14 | |
| 15 | chrome.storage.session.get( |
| 16 | "normalModeKeyStateMapping", |
| 17 | (items) => this.setKeyMapping(items.normalModeKeyStateMapping), |
| 18 | ); |
| 19 | |
| 20 | chrome.storage.onChanged.addListener((changes, area) => { |
| 21 | if (area === "session" && changes.normalModeKeyStateMapping?.newValue) { |
| 22 | this.setKeyMapping(changes.normalModeKeyStateMapping.newValue); |
| 23 | } |
| 24 | }); |
| 25 | } |
| 26 | |
| 27 | commandHandler({ command: registryEntry, count }) { |
| 28 | if (registryEntry.options.count) { |
no test coverage detected