(file)
| 66 | } |
| 67 | |
| 68 | build(file) { |
| 69 | this.reset(); |
| 70 | if (!file) return; |
| 71 | |
| 72 | if (this.tracerApiSource) this.tracerApiSource.cancel(); |
| 73 | this.tracerApiSource = axios.CancelToken.source(); |
| 74 | this.setState({ building: true }); |
| 75 | |
| 76 | const ext = extension(file.name); |
| 77 | if (ext in TracerApi) { |
| 78 | TracerApi[ext]({ code: file.content }, undefined, this.tracerApiSource.token) |
| 79 | .then(commands => { |
| 80 | this.tracerApiSource = null; |
| 81 | this.setState({ building: false }); |
| 82 | this.reset(commands); |
| 83 | this.next(); |
| 84 | }) |
| 85 | .catch(error => { |
| 86 | if (axios.isCancel(error)) return; |
| 87 | this.tracerApiSource = null; |
| 88 | this.setState({ building: false }); |
| 89 | this.handleError(error); |
| 90 | }); |
| 91 | } else { |
| 92 | this.setState({ building: false }); |
| 93 | this.handleError(new Error('Language Not Supported')); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | isValidCursor(cursor) { |
| 98 | const { chunks } = this.props.player; |
nothing calls this directly
no test coverage detected