MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / addButtonAfter

Method addButtonAfter

src/lib/MenuComponent.ts:32–45  ·  view source on GitHub ↗

* Add a button after another button

(after: string, button: MenuButton)

Source from the content-addressed store, hash-verified

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

Callers 1

setupMethod · 0.80

Calls 3

buttonsMethod · 0.95
onConfigurationUpdateMethod · 0.95
configurationMethod · 0.65

Tested by

no test coverage detected