dominiccooney / cache-polyfill

Service Worker Cache polyfill extracted from https://jakearchibald.github.io/trained-to-thrill/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: Cache is not defined

givingwu opened this issue · comments

May u should merge this PR from @QingLeiLi to avoid this error.

(anonymous function)
internal:///Users/vuchan/Development/WorkSpace/***/node_modules/_serviceworker-cache-polyfill@4.0.0@serviceworker-cache-polyfill/index.js:19
(function() {
> 19 |   var nativeAddAll = Cache.prototype.addAll;
  20 |   var userAgent = navigator.userAgent.match(/(Firefox|Chrome)\/(\d+\.)/);
  21 | 
  22 |   // Has nice behavior of `var` which everyone hates

I tried his solution, but also got an error, it does not work.

this works:

if (window.Cache === undefined) return;

@vuchan Could you open a PR for it? Then I can close my bad one.

@QingLeiLi well, I made this.

Is this fixed?