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

New workbox.expiration.Plugin.deleteCacheAndMetadata() method #1500

Merged
merged 2 commits into from
May 26, 2018

Conversation

jeffposnick
Copy link
Contributor

R: @philipwalton
CC: @josephliccini

Fixes #1365

It took a while to get a hang of what needed to be explicitly close()d in order to avoid blocked errors, but I think this implementation works.

I envision making use of this as part of a future PR that will start introducing some opt-in automatic cleanup logic to handle, e.g., QUOTA_EXCEEDED errors. For the time being, though, this is just a standalone method that won't be called anywhere automatically.

@jeffposnick jeffposnick requested a review from philipwalton May 25, 2018 21:05
if (localBrowser.getReleaseName() === 'beta') {
await runIntegrationForBrowser(localBrowser);
}
await runIntegrationForBrowser(localBrowser);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a holdover from when the stable version of Safari lacked SW support. I took the opportunity to drop that restriction as part of this PR.

@workbox-pr-bot
Copy link
Collaborator

PR-Bot Size Plugin

Changed File Sizes

No file sizes have changed.

New Files

File Size GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 1.45 KB
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.12 KB 584 B
packages/workbox-build/build/_types.js 41 B 61 B
packages/workbox-build/build/index.js 4.02 KB 1.57 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.78 KB 1.33 KB
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 587 B 345 B
packages/workbox-cli/build/app.js 6.50 KB 2.16 KB
packages/workbox-cli/build/bin.js 2.32 KB 1.03 KB
packages/workbox-core/build/workbox-core.prod.js 6.86 KB 2.73 KB
packages/workbox-google-analytics/build/workbox-google-analytics.prod.js 2.12 KB 1.03 KB
packages/workbox-precaching/build/workbox-precaching.prod.js 5.68 KB 2.16 KB
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 797 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 1.31 KB
packages/workbox-strategies/build/workbox-strategies.prod.js 4.30 KB 1.14 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.66 KB 765 B
packages/workbox-sw/build/workbox-sw.js 1.47 KB 792 B
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 2.57 KB
packages/workbox-webpack-plugin/build/index.js 742 B 470 B
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 3.23 KB

All File Sizes

View Table
File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 1.45 KB
packages/workbox-broadcast-cache-update/build/workbox-broadcast-cache-update.prod.js 1.12 KB 584 B
packages/workbox-build/build/_types.js 41 B 61 B
packages/workbox-build/build/index.js 4.02 KB 1.57 KB
packages/workbox-cache-expiration/build/workbox-cache-expiration.prod.js 3.78 KB 1.33 KB
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 587 B 345 B
packages/workbox-cli/build/app.js 6.50 KB 2.16 KB
packages/workbox-cli/build/bin.js 2.32 KB 1.03 KB
packages/workbox-core/build/workbox-core.prod.js 6.86 KB 2.73 KB
packages/workbox-google-analytics/build/workbox-google-analytics.prod.js 2.12 KB 1.03 KB
packages/workbox-precaching/build/workbox-precaching.prod.js 5.68 KB 2.16 KB
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 797 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 1.31 KB
packages/workbox-strategies/build/workbox-strategies.prod.js 4.30 KB 1.14 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.66 KB 765 B
packages/workbox-sw/build/workbox-sw.js 1.47 KB 792 B
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 2.57 KB
packages/workbox-webpack-plugin/build/index.js 742 B 470 B
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 3.23 KB

Workbox Aggregate Size Plugin

☠️ WARNING ☠️

We are using 170% of our max size budget.

Total Size: 24.93KB
Percentage of Size Used: 170%

Gzipped: 9.57KB

Copy link
Member

@philipwalton philipwalton left a comment

Choose a reason for hiding this comment

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

LGTM

@surajrautela
Copy link

I am still not able to use this method . I am using workbox files from https://storage.googleapis.com/workbox-cdn/releases/3.2.0/workbox-sw.js . On trying to to use this function is throws an error that deleteCacheAndMetadata() is not a method. Can we have a sample code snippet which can help just in case i am doing something wrong

@jeffposnick
Copy link
Contributor Author

Sorry, we haven't yet cut a new release of Workbox that includes the changes in this PR. There are a few other open PRs that it would be good to get merged first, and then we'll cut a new release that includes deleteCacheAndMetadata().

(If you can't wait, you could do a gulp build on the master branch of a local copy of this repo, and then run packages/workbox-cli/build/bin.js copyLibraries /path/to/directory to make a local copy of the latest libraries.)

@surajrautela
Copy link

Really appreciate such a fast response . By what time are you guys planning to have a new release?

@jeffposnick jeffposnick changed the title New workbox.Plugin.deleteCacheAndMetadata() method New workbox.expiration.Plugin.deleteCacheAndMetadata() method Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add helper method to cleanup cache + expiration data in IDB
4 participants