MCPcopy
hub / github.com/spicetify/cli / onSwap

Function onSwap

jsHelper/homeConfig.js:121–130  ·  view source on GitHub ↗
(item, dir)

Source from the content-addressed store, hash-verified

119 }
120
121 function onSwap(item, dir) {
122 container.remove();
123 const curPos = elem.findIndex((e) => e === item);
124 const newPos = curPos + dir;
125 if (newPos < 0 || newPos > elem.length - 1) return;
126
127 [elem[curPos], elem[newPos]] = [elem[newPos], elem[curPos]];
128 [list[curPos], list[newPos]] = [list[newPos], list[curPos]];
129 appendItems();
130 }
131
132 function onChangeStatus(item, status) {
133 container.remove();

Callers 2

injectInteractionFunction · 0.70
ServiceOptionFunction · 0.50

Calls 1

appendItemsFunction · 0.70

Tested by

no test coverage detected