MCPcopy Create free account
hub / github.com/alienkitty/space.js / update

Method update

src/ui/Menu.js:82–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80 }
81
82 update() {
83 const active = this.names[this.index];
84
85 this.events.emit('update', { active, index: this.index, target: this });
86
87 if (this.callback) {
88 this.callback(active, this);
89 }
90
91 const target = this.items[this.index];
92 const direction = this.active > this.index ? 1 : -1;
93
94 this.active = this.index;
95
96 if (target && !target.active) {
97 target.activate(direction);
98 }
99
100 this.items.forEach(item => {
101 if (item !== target && item.active) {
102 item.deactivate(direction);
103 }
104 });
105 }
106
107 animateIn() {
108 this.items.forEach((item, i) => item.animateIn(i * 200));

Callers 2

constructorMethod · 0.95
MenuClass · 0.95

Calls 3

emitMethod · 0.80
activateMethod · 0.45
deactivateMethod · 0.45

Tested by

no test coverage detected