MCPcopy Index your code
hub / github.com/spicetify/cli / onSwap

Function onSwap

jsHelper/sidebarConfig.js:99–107  ·  view source on GitHub ↗
(item, dir)

Source from the content-addressed store, hash-verified

97
98 function injectInteraction() {
99 function onSwap(item, dir) {
100 container.remove();
101 const curPos = ordered.findIndex((e) => e[0] === item);
102 const newPos = curPos + dir;
103 if (newPos < 0 || newPos > ordered.length - 1) return;
104
105 [ordered[curPos], ordered[newPos]] = [ordered[newPos], ordered[curPos]];
106 appendItems();
107 }
108
109 function onChangeStatus(item, status) {
110 container.remove();

Callers 1

injectInteractionFunction · 0.70

Calls 1

appendItemsFunction · 0.70

Tested by

no test coverage detected