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

Method addButtonBefore

src/lib/MenuComponent.ts:50–63  ·  view source on GitHub ↗

* Add a button before another button

(before: string, button: MenuButton)

Source from the content-addressed store, hash-verified

48 * Add a button before another button
49 */
50 static addButtonBefore (before: string, button: MenuButton): void {
51 const index = this.buttons().findIndex((b: MenuButton) => b.string === before);
52 const buttons = [...this.buttons()];
53
54 if (index > -1) {
55 buttons.splice(index, 0, button);
56
57 this.engine.configuration(this.tag, {
58 buttons
59 });
60
61 this.onConfigurationUpdate();
62 }
63 }
64
65 /**
66 * Remove a button by its string identifier

Callers

nothing calls this directly

Calls 3

buttonsMethod · 0.95
onConfigurationUpdateMethod · 0.95
configurationMethod · 0.65

Tested by

no test coverage detected