MCPcopy Index your code
hub / github.com/algorithm-visualizer/algorithm-visualizer / reset

Function reset

src/components/Player/index.js:43–66  ·  view source on GitHub ↗
(commands = [])

Source from the content-addressed store, hash-verified

41 }
42
43 reset(commands = []) {
44 const chunks = [{
45 commands: [],
46 lineNumber: undefined,
47 }];
48 while (commands.length) {
49 const command = commands.shift();
50 const { key, method, args } = command;
51 if (key === null && method === 'delay') {
52 const [lineNumber] = args;
53 chunks[chunks.length - 1].lineNumber = lineNumber;
54 chunks.push({
55 commands: [],
56 lineNumber: undefined,
57 });
58 } else {
59 chunks[chunks.length - 1].commands.push(command);
60 }
61 }
62 this.props.setChunks(chunks);
63 this.props.setCursor(0);
64 this.pause();
65 this.props.setLineIndicator(undefined);
66 }
67
68 build(file) {
69 this.reset();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected