Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sw precaching #76

Merged
merged 20 commits into from
Dec 2, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/sw-precaching/src/lib/revisioned-cache-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ class RevisionedCacheManager {
this._fileEntriesToCache = this._fileEntriesToCache.concat(parsedFileList);
}

/**
* This method ensures that the file entry in the file maniest is valid and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maniest -> manifest?

* if the entry is a revisioned string path, it is converted to an object
* with the desired fields.
* @param {String | object} fileEntry Either a path for a file or an object
* with a `path`, `revision` and optional `cacheBust` parameter.
* @return {object} Returns a parsed version of the file entry with absolute
* URL, revision and a cacheBust value.
*/
_validateFileEntry(fileEntry) {
let parsedFileEntry = fileEntry;
if (typeof parsedFileEntry === 'string') {
Expand Down Expand Up @@ -138,6 +147,13 @@ class RevisionedCacheManager {
});
}

/**
* This method manages the actual install event to cache the revisioned
* assets.
* @param {String} cacheName The name to use for the cache
* @return {Promise} The promise resolves when all the desired assets are
* cached.
*/
_performInstallStep(cacheName) {
cacheName = cacheName || defaultCacheName;

Expand Down Expand Up @@ -257,6 +273,9 @@ class RevisionedCacheManager {
return parsedURL.toString();
}

/**
* This method closes the indexdDB helper.
*/
_close() {
this._idbHelper.close();
}
Expand Down