feat(service-worker): support multiple apps on different subpaths of a domain (#27080)

Previously, it was not possible to have multiple apps (using
`@angular/service-worker`) on different subpaths of the same domain,
because each SW would overwrite the caches of the others (even though
their scope was different).

This commit fixes it by ensuring that the cache names created by the SW
are different for each scope.

Fixes #21388

PR Close #27080
This commit is contained in:
Sheik Althaf
2019-03-20 23:29:15 +02:00
committed by Matias Niemelä
parent 37a154e4e6
commit e721c08c7f
7 changed files with 34 additions and 15 deletions

View File

@ -12,5 +12,5 @@ import {Driver} from './src/driver';
const scope = self as any as ServiceWorkerGlobalScope;
const adapter = new Adapter();
const adapter = new Adapter(scope);
const driver = new Driver(scope, adapter, new CacheDatabase(scope, adapter));