| 33 | } = {}; |
| 34 | |
| 35 | async loadUrl(manifestUrl: string, gzippedManifestUrl: string): Promise<boolean> { |
| 36 | let classInfoUrl = manifestUrl.substring(0, manifestUrl.lastIndexOf("\/") + 1) + "ClassInfo.json"; |
| 37 | |
| 38 | try { |
| 39 | let classInfoResponse = await axios.get(classInfoUrl); |
| 40 | this.classInfo = classInfoResponse.data as { [key: string]: ClassInfo }; |
| 41 | } catch { |
| 42 | // classInfo is optional |
| 43 | } |
| 44 | try { |
| 45 | try { |
| 46 | let manifestResponse = await axios.get(manifestUrl) |
| 47 | this.componentSet = manifestResponse.data as ComponentSet; |
| 48 | } catch { |
| 49 | let manifestResponse = await axios.get(gzippedManifestUrl, {responseType: 'arraybuffer', 'decompress': true }) |
| 50 | this.componentSet = JSON.parse(pako.inflate(manifestResponse.data, { to: 'string' })) as ComponentSet; |
| 51 | } |
| 52 | this.populateCaches(); |
| 53 | } catch { |
| 54 | return false; |
| 55 | } |
| 56 | |
| 57 | this.manifestUrl = manifestUrl; |
| 58 | this.gzippedManifestUrl = gzippedManifestUrl; |
| 59 | this.classInfoUrl = classInfoUrl; |
| 60 | return true; |
| 61 | } |
| 62 | |
| 63 | async loadFile(manifestFile: File): Promise<boolean> { |
| 64 | let manifestResponse = await this.readFileAsync(manifestFile) |