admin管理员组文章数量:1327804
Is there a way to match wildcard URLs on a serviceWorker
's install
event?
I'd like to be able to match something like *.bundle.js
.
self.addEventListener('install', event => {
event.waitUntil(
caches.open(latest.cache).then(cache => {
return cache.addAll([
'/',
'*.bundle.js'
])
})
)
})
Is there a way to match wildcard URLs on a serviceWorker
's install
event?
I'd like to be able to match something like *.bundle.js
.
self.addEventListener('install', event => {
event.waitUntil(
caches.open(latest.cache).then(cache => {
return cache.addAll([
'/',
'*.bundle.js'
])
})
)
})
Share
Improve this question
edited Feb 18, 2017 at 20:17
Raphael Rafatpanah
asked Feb 18, 2017 at 20:11
Raphael RafatpanahRaphael Rafatpanah
20k28 gold badges105 silver badges174 bronze badges
1 Answer
Reset to default 9I don't think that's possible since you're not caching strings or urls, but requests.
There is a thing from Google that might be of use, the sw-precache module. This can generate a service worker through Gulp or the mandline. It works alongside the service worker toolbox.
本文标签: javascriptCan cacheaddAll accept wildcard matchesStack Overflow
版权声明:本文标题:javascript - Can cache.addAll accept wildcard matches? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742229234a2436908.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论