()
| 101 | } |
| 102 | |
| 103 | send() { |
| 104 | if ((toSend === -1 && this.progress.size > 0 && this.progress.size > this.done.size) || toSend === this.st) { |
| 105 | const progress = Math.min(100, [...this.progress.values()].reduce((a, x) => a + x[0], 0) / [...this.progress.values()].reduce((a, x) => a + x[1], 0) * 100); // Clamp progress to 0-100 |
| 106 | |
| 107 | sendState(this.st ? 'installing' : 'downloading', { |
| 108 | current: this.done.size + 1, |
| 109 | total: this.total.size, |
| 110 | progress |
| 111 | }); |
| 112 | |
| 113 | return true; |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | const initNew = async (inst) => { |
no test coverage detected