George Kalpakas 356dd2107b refactor(service-worker): simplify accessing CacheStorage throughout the ServiceWorker (#42622)
This commit simplifies/systemizes accessing the `CacheStorage` through a
wrapper, with the following benefits:
- Ensuring a consistent cache name prefix is used for all caches
  (without having to repeat the prefix in different places).
- Allowing referring to caches using their name without the common
  cache name prefix.
- Exposing the cache name on cache instances, which for example makes it
  easier to delete caches without having to keep track of the name used
  to create them.

PR Close #42622
2021-06-24 09:55:32 -07:00

17 lines
510 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Adapter} from './src/adapter';
import {CacheDatabase} from './src/db-cache';
import {Driver} from './src/driver';
const scope = self as unknown as ServiceWorkerGlobalScope;
const adapter = new Adapter(scope.registration.scope, self.caches);
new Driver(scope, adapter, new CacheDatabase(adapter));