Skip to content

Instantly share code, notes, and snippets.

@alex-min
Last active April 3, 2017 19:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-min/1bbc304ad9b96bdf5c96 to your computer and use it in GitHub Desktop.
Save alex-min/1bbc304ad9b96bdf5c96 to your computer and use it in GitHub Desktop.
manifest api

APPCache Api

You can now put headers inside the manifest :

CACHE MANIFEST
#////////////////////////
# Max-Validity: 2 Weeks and 5 Hours
# Check-Update-Every: 60 Minutes
# Update-Style: Immediate
# On-Update: reload
# On-Download: showLoadbar
#///////////////////////

CACHE:
/js/file1.js
/js/file2.js

JS API:

  • Getting the list of files
manifest.getFileList()
> [{"name":"/js/file1.js", "size":440}, {"name":"/js/file2.js", "size":10}]
  • Getting the total size of all the files stored
manifest.getTotalSize()
> 450
  • Force the check of an update
manifest.checkUpdates()
  • Getting attributes
manifest.getAttributes()
> {Max-Validity: 1227600, Check-Update-Every: 3600, Update-Style: "Immediate", On-Update: "reload", On-Download: "showLoadbar"}
  • Getting an attribute value
manifest.getAttribute('Max-Validity')
> 1227600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment