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

Add a cache listener message response #1906

Merged
merged 1 commit into from
Feb 19, 2019
Merged

Conversation

philipwalton
Copy link
Member

R: @jeffposnick @philipwalton

When writing the workbow-window documentation, I realized that the logic in Router#addCacheListener includes a check for meta === 'workbox-window', but we shouldn't require developers to be use workbox-window to cache URLs (or ask them to set that meta value themselves, which wouldn't make sense).

This PR removes that check. It also adds a response to the message event if it contains a message channel (which workbox-window message do by default). This allows users to await successful caching of all URLs, similar to what you get with precaching.

Note: I did not add a message response in the event of an error, but I potentially could? WDYT?

@workbox-pr-bot
Copy link
Collaborator

PR-Bot Size Plugin

Changed File Sizes

File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 3.60 KB +3% 1.56 KB
packages/workbox-build/build/index.js 4.02 KB 3.64 KB -9% 1.36 KB
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 587 B 584 B -1% 348 B
packages/workbox-cli/build/app.js 6.76 KB 5.58 KB -17% 1.98 KB 🎉
packages/workbox-cli/build/bin.js 2.32 KB 1.16 KB -50% 580 B 🎉
packages/workbox-core/build/workbox-core.prod.js 7.47 KB 5.43 KB -27% 2.36 KB 🎉
packages/workbox-navigation-preload/build/workbox-navigation-preload.prod.js 660 B 657 B -0% 321 B
packages/workbox-precaching/build/workbox-precaching.prod.js 5.80 KB 4.21 KB -27% 1.69 KB 🎉
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 1.52 KB -7% 761 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 3.36 KB +17% 1.46 KB ☠️
packages/workbox-strategies/build/workbox-strategies.prod.js 5.09 KB 4.86 KB -4% 1.19 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.57 KB 1.38 KB -12% 682 B 🎉
packages/workbox-sw/build/workbox-sw.js 1.50 KB 1.34 KB -11% 745 B 🎉
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 5.29 KB -34% 1.84 KB 🎉
packages/workbox-webpack-plugin/build/index.js 742 B 349 B -53% 255 B 🎉
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 7.22 KB -30% 2.48 KB 🎉

New Files

File Size GZipped
packages/workbox-broadcast-update/build/workbox-broadcast-update.prod.js 1.85 KB 934 B
packages/workbox-expiration/build/workbox-expiration.prod.js 2.84 KB 1.24 KB
packages/workbox-google-analytics/build/workbox-offline-ga.prod.js 1.90 KB 902 B
packages/workbox-window/build/workbox-window.dev.umd.js 30.23 KB 7.99 KB
packages/workbox-window/build/workbox-window.prod.umd.js 4.66 KB 1.80 KB

All File Sizes

View Table
File Before After Change GZipped
packages/workbox-background-sync/build/workbox-background-sync.prod.js 3.51 KB 3.60 KB +3% 1.56 KB
packages/workbox-broadcast-update/build/workbox-broadcast-update.prod.js 1.85 KB 934 B
packages/workbox-build/build/_types.js 41 B 41 B 0% 61 B
packages/workbox-build/build/index.js 4.02 KB 3.64 KB -9% 1.36 KB
packages/workbox-cacheable-response/build/workbox-cacheable-response.prod.js 587 B 584 B -1% 348 B
packages/workbox-cli/build/app.js 6.76 KB 5.58 KB -17% 1.98 KB 🎉
packages/workbox-cli/build/bin.js 2.32 KB 1.16 KB -50% 580 B 🎉
packages/workbox-core/build/workbox-core.prod.js 7.47 KB 5.43 KB -27% 2.36 KB 🎉
packages/workbox-expiration/build/workbox-expiration.prod.js 2.84 KB 1.24 KB
packages/workbox-google-analytics/build/workbox-offline-ga.prod.js 1.90 KB 902 B
packages/workbox-navigation-preload/build/workbox-navigation-preload.prod.js 660 B 657 B -0% 321 B
packages/workbox-precaching/build/workbox-precaching.prod.js 5.80 KB 4.21 KB -27% 1.69 KB 🎉
packages/workbox-range-requests/build/workbox-range-requests.prod.js 1.63 KB 1.52 KB -7% 761 B
packages/workbox-routing/build/workbox-routing.prod.js 2.87 KB 3.36 KB +17% 1.46 KB ☠️
packages/workbox-strategies/build/workbox-strategies.prod.js 5.09 KB 4.86 KB -4% 1.19 KB
packages/workbox-streams/build/workbox-streams.prod.js 1.57 KB 1.38 KB -12% 682 B 🎉
packages/workbox-sw/build/workbox-sw.js 1.50 KB 1.34 KB -11% 745 B 🎉
packages/workbox-webpack-plugin/build/generate-sw.js 8.04 KB 5.29 KB -34% 1.84 KB 🎉
packages/workbox-webpack-plugin/build/index.js 742 B 349 B -53% 255 B 🎉
packages/workbox-webpack-plugin/build/inject-manifest.js 10.30 KB 7.22 KB -30% 2.48 KB 🎉
packages/workbox-window/build/workbox-window.dev.umd.js 30.23 KB 7.99 KB
packages/workbox-window/build/workbox-window.prod.umd.js 4.66 KB 1.80 KB

Workbox Aggregate Size Plugin

8.82KB gzip'ed (59% of limit)
22.1KB uncompressed

@jeffposnick jeffposnick merged commit 8496e07 into next Feb 19, 2019
@jeffposnick jeffposnick deleted the cache-listener-updates branch February 19, 2019 18:02
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.

3 participants