(...args)
| 232 | } |
| 233 | |
| 234 | exit(...args) { |
| 235 | if (this.modeIsExiting || !this.modeIsActive) { |
| 236 | return; |
| 237 | } |
| 238 | |
| 239 | this.log("deactivate:", this.id); |
| 240 | this.modeIsExiting = true; |
| 241 | |
| 242 | for (const handler of this.exitHandlers) { |
| 243 | // TODO(philc): Is this array.from necessary? |
| 244 | handler(...Array.from(args || [])); |
| 245 | } |
| 246 | |
| 247 | for (const handlerId of this.handlers) { |
| 248 | handlerStack.remove(handlerId); |
| 249 | } |
| 250 | |
| 251 | Mode.modes = Mode.modes.filter((mode) => mode !== this); |
| 252 | |
| 253 | this.modeIsActive = false; |
| 254 | return this.setIndicator(); |
| 255 | } |
| 256 | |
| 257 | // Debugging routines. |
| 258 | logModes() { |
no test coverage detected