* Add a button after another button
(after: string, button: MenuButton)
| 30 | * Add a button after another button |
| 31 | */ |
| 32 | static addButtonAfter (after: string, button: MenuButton): void { |
| 33 | const index = this.buttons().findIndex((b: MenuButton) => b.string === after); |
| 34 | const buttons = [...this.buttons()]; |
| 35 | |
| 36 | if (index > -1) { |
| 37 | buttons.splice(index + 1, 0, button); |
| 38 | |
| 39 | this.engine.configuration(this.tag, { |
| 40 | buttons |
| 41 | }); |
| 42 | |
| 43 | this.onConfigurationUpdate(); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Add a button before another button |
no test coverage detected