MCPcopy
hub / github.com/angular/angular / constructor

Function constructor

packages/service-worker/worker/src/assets.ts:57–84  ·  view source on GitHub ↗
(
    protected scope: ServiceWorkerGlobalScope,
    protected adapter: Adapter,
    protected idle: IdleScheduler,
    protected config: AssetGroupConfig,
    protected hashes: Map<string, string>,
    protected db: Database,
    cacheNamePrefix: string,
  )

Source from the content-addressed store, hash-verified

55 protected metadata: Promise<Table>;
56
57 constructor(
58 protected scope: ServiceWorkerGlobalScope,
59 protected adapter: Adapter,
60 protected idle: IdleScheduler,
61 protected config: AssetGroupConfig,
62 protected hashes: Map<string, string>,
63 protected db: Database,
64 cacheNamePrefix: string,
65 ) {
66 this.name = config.name;
67
68 // Normalize the config's URLs to take the ServiceWorker's scope into account.
69 this.urls = config.urls.map((url) => adapter.normalizeUrl(url));
70
71 // Patterns in the config are regular expressions disguised as strings. Breathe life into them.
72 this.patterns = config.patterns.map((pattern) => new RegExp(pattern));
73
74 // This is the primary cache, which holds all of the cached requests for this group. If a
75 // resource isn't in this cache, it hasn't been fetched yet.
76 this.cache = adapter.caches.open(`${cacheNamePrefix}:${config.name}:cache`);
77
78 // This is the metadata table, which holds specific information for each cached URL, such as
79 // the timestamp of when it was added to the cache.
80 this.metadata = this.db.open(
81 `${cacheNamePrefix}:${config.name}:meta`,
82 config.cacheQueryOptions,
83 );
84 }
85
86 async cacheStatus(url: string): Promise<UpdateCacheStatus> {
87 const cache = await this.cache;

Callers

nothing calls this directly

Calls 3

mapMethod · 0.80
normalizeUrlMethod · 0.80
openMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…