(file)
| 117 | } |
| 118 | |
| 119 | readFile(file) { |
| 120 | this.dispatchEvent(new CustomEvent('fileuploadstart', { |
| 121 | bubbles: true, |
| 122 | composed: true, |
| 123 | detail: { |
| 124 | progressCallback: this.setProgress.bind(this), |
| 125 | totalSize: file.size, |
| 126 | } |
| 127 | })); |
| 128 | if (!file) { |
| 129 | this.error = 'Failed to load file.'; |
| 130 | return; |
| 131 | } |
| 132 | this.fileReader.blur(); |
| 133 | this.setProgress(0); |
| 134 | this.root.className = 'loading'; |
| 135 | // Delay the loading a bit to allow for CSS animations to happen. |
| 136 | window.requestAnimationFrame(() => this.asyncReadFile(file)); |
| 137 | } |
| 138 | |
| 139 | async asyncReadFile(file) { |
| 140 | this.updateProgressBar(); |
no test coverage detected