Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cache-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-polyfill

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

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
126
decreased by-36.68%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 16 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc