GithubHelp home page GithubHelp logo

chriscapaci / cache-polyfill Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jimmywarting/cache-polyfill

0.0 0.0 1.0 70 KB

cache polyfill, Offline storage, Wraps IndexedDB, without https/ssl

License: MIT License

JavaScript 99.39% HTML 0.61%

cache-polyfill's Introduction

cache-polyfill

cache polyfill, Offline storage, Wraps IndexedDB, works without https/ssl

PWA builder! This is for you who don't have a ssl or need to support older browser.

Example Usage

import { Cache, CacheStorage, caches } from 'cache-polyfill'
// import 'whatwg-fetch'

// example usage:
caches.open('v1').then(function(cache) {
  return cache.addAll([
    '/asset/index.html',
    '/asset/star-wars-logo.jpg',
    '/asset/gallery/bountyHunters.jpg',
    '/asset/gallery/myLittleVader.jpg',
    '/asset/gallery/snowTroopers.jpg'
  ])
})

const request = new Request('/asset/component.tpl')
caches.match(request).then(response => {
  return response || fetch(request).then(response => {
    caches.open('v1').then(cache =>
      cache.put(event.request, response)
    )
    return response.clone()
  })
})

Documentation and more example over at mozilla - Cache

cache-polyfill's People

Contributors

jimmywarting avatar k15a avatar

Forkers

fudanchii

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.