(
protected scope: ServiceWorkerGlobalScope,
protected adapter: Adapter,
protected idle: IdleScheduler,
protected config: AssetGroupConfig,
protected hashes: Map<string, string>,
protected db: Database,
cacheNamePrefix: string,
)
| 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; |
nothing calls this directly
no test coverage detected
searching dependent graphs…