Editor moves
This commit is contained in:
@@ -27,6 +27,14 @@ export async function addRun(run: LiveRun) {
|
|||||||
liveRuns.push(run);
|
liveRuns.push(run);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function addLiveRunMove(id: string) {
|
export async function addLiveRunMoves(id: string, moves: LiveRunMove[]) {
|
||||||
if (!liveRuns.find((r) => r.id === id)) throw "Invalid run";
|
if (!liveRunMoves[id]) throw "Invalid run";
|
||||||
|
|
||||||
|
// Add the moves immediately
|
||||||
|
liveRunMoves[id] = [...liveRunMoves[id], ...moves];
|
||||||
|
|
||||||
|
// After 3 seconds, remove only the moves we just added
|
||||||
|
setTimeout(() => {
|
||||||
|
liveRunMoves[id] = liveRunMoves[id].filter((move) => !moves.includes(move));
|
||||||
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user