Skip to content

Instantly share code, notes, and snippets.

@StefH
Last active June 20, 2020 06:47
Show Gist options
  • Save StefH/fc3ebc9da1a9f207291def517247e77e to your computer and use it in GitHub Desktop.
Save StefH/fc3ebc9da1a9f207291def517247e77e to your computer and use it in GitHub Desktop.
export class WebAssemblyResourceLoader {
// ...
loadResources(resources: ResourceList, url: (name: string) => string, resourceType: WebAssemblyBootResourceType): LoadingResource[] {
return Object.keys(resources)
.map(name => this.loadResource(name, url(name), resources[name], resourceType));
}
loadResource(name: string, url: string, contentHash: string, resourceType: WebAssemblyBootResourceType): LoadingResource {
const response = this.cacheIfUsed
? this.loadResourceWithCaching(this.cacheIfUsed, name, url, contentHash, resourceType)
: this.loadResourceWithoutCaching(name, url, contentHash, resourceType);
return { name, url, response };
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment