How to use the @angular/service-worker/worker.copyExistingOrFetchOp function in @angular/service-worker

To help you get started, we’ve selected a few @angular/service-worker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / mobile-toolkit / service-worker / worker / src / plugins / static / index.ts View on Github external
.map(url => {
        const hash = this.staticManifest.urls[url];
        const previousHash = previous.staticManifest.urls[url];
        if (previousHash === hash) {
          LOG.technical(`update(${this.cacheKey}, ${url}): no need to refresh ${url} in the cache`);
          return copyExistingOrFetchOp(previous.worker, this.worker, url, this.cacheKey);
        } else {
          LOG.technical(`update(${this.cacheKey}, ${url}): caching from network`);
          return cacheFromNetworkOp(this.worker, url, this.cacheKey, shouldCacheBust(url));
        }
      })
    );