| 20 | readonly origin: string; |
| 21 | |
| 22 | constructor( |
| 23 | protected readonly scopeUrl: string, |
| 24 | caches: T, |
| 25 | ) { |
| 26 | const parsedScopeUrl = this.parseUrl(this.scopeUrl); |
| 27 | |
| 28 | // Determine the origin from the registration scope. This is used to differentiate between |
| 29 | // relative and absolute URLs. |
| 30 | this.origin = parsedScopeUrl.origin; |
| 31 | |
| 32 | // Use the baseHref in the cache name prefix to avoid clash of cache names for SWs with |
| 33 | // different scopes on the same domain. |
| 34 | this.caches = new NamedCacheStorage(caches, `ngsw:${parsedScopeUrl.path}`); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Wrapper around the `Request` constructor. |