Git Product home page Git Product logo

cache-polyfill's People

Contributors

dandv avatar dominiccooney avatar jakearchibald avatar markdalgleish avatar mathiasbynens avatar nekr avatar paullewis avatar wibblymat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cache-polyfill's Issues

cachesPolyfill has no method `get`

This method is shown in the README but doesn't exist on the cachesPolyfill object returned from the import. I don't think get is in the spec, but I'm not 100% so have opened an issue instead of a PR that implements get.

Not obsolete anymore (yet again..?)

Obsolete polyfill for the ServiceWorker cache API. Chrome 46 and Opera 33 support addAll now.

I think this is wrong since addAll() gets new algorithm soon. I am not sure I can properly rephrase that sentence, so just creating an issue instead of PR.

Plus, you have to publish v4 to NPM :-)

cache-polyfill for nodejs

Looking at the source, I realize this may not be the goal of this project.

But, I came to this project hoping to find a Cache polyfill for node.js. In node.js (at least v8.11.1) there is no Cache object, and I could really use this object.

So I realize this is a big stretch... is there an interest for this project to build a full Cache implementation for node?

addAll( request, callback) to get more control about caching a bulk of responses.

I think that It will be useful to add a callback function (function(response)) as parameter to the cache.addAll(requests,callback), this allow get more control over the responses and decide which will be cached, i.e. if response.status < 400 not store on cached.
This callback could return true/false to control what response is valid to be cached.
Thanks, great work,

Detect duplicated resources (catch TypeError exception).

By error a had duplicated resources but the cache not show any error (console, ...). I saw that the cachedb check this and throw an exception TypeError. I changed the addAll to notify about it:

CacheProto.addAll = function(requests) {
  requests = requests.map(castToRequest);

  Promise.all(
     requests.map(function(request) {
         return fetch(request);
    })
  ).then(function(responses) {
    return cacheDB.put(this._origin, this._name, responses.map(function(response, i) {
      return [requests[i], response];
    }));
  }.bind(this)).catch(function(err){ 
      console.log(err);
  });
};

Once time a fix the duplicated I detect that Response don't has asBlob property and changed
return item[1].asBlob ? item[1].asBlob() : item[1].body.asBlob();
to
return item[1].blob ? item[1].blob() : item[1].body.asBlob();

I hope that will be right and helpful.

ReferenceError: Cache is not defined

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

(anonymous function)
internal:///Users/vuchan/Development/WorkSpace/***/node_modules/[email protected]@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

IE11

Great polyfill.

Will this cache polyfill allows my a PWA app to work in the older browsers such as IE10 or IE11? My goals is to find a way via the polyfill (or any other ways) to either turn-off the Service Worker caching when its IE, or help my app to work without breaking. I am using sw-precache to create the Service Worker.

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.