[PWA] 11. Serve skeleton cache for root
Intead of cache the root floder, we want to cache skeleton instead.
self.addEventListener('install', function (event) {
event.waitUntil(
caches.open(staticCacheName).then(function (cache) {
return cache.addAll([
'/skeleton',
'js/main.js',
'css/main.css',
'imgs/icon.png',
'https://fonts.gstatic.com/s/roboto/v15/2UX7WLTfW3W8TclTUvlFyQ.woff',
'https://fonts.gstatic.com/s/roboto/v15/d-6IYplOFocCacKzxwXSOD8E0i7KZn-EPnyo3HZu7kw.woff'
]);
})
);
});
Respond to requests for the root page with thepage skeleton from the cache:
self.addEventListener('fetch', function (event) {
// use the page skeleton from the cache
let requestUrl = new URL(event.request.url);
if(requestUrl.origin === location.origin){
if(requestUrl.pathname === '/'){
event.respondWith(
caches.match('/skeleton')
);
return;
}
}
event.respondWith(
caches.match(event.request).then(function (response) {
return response || fetch(event.request);
})
);
});
[PWA] 11. Serve skeleton cache for root的更多相关文章
- Exception in thread "main" org.hibernate.MappingException: You may only specify a cache for root
如果出现类似下面的错误: Exception in thread "main" org.hibernate.MappingException: You may only speci ...
- mysql5.7.11编译安装以及修改root密码小结
系统是cenos6.7 64位的,默认mysql5.7.11下载到/usr/local/src,安装目录在/app/local/mysql目录下,mysql数据放置目录/app/local/data. ...
- [Laravel] 11 - WEB API : cache & timer
前言 一.资源 Ref: https://www.imooc.com/video/2870 二.缓存 缓存:静态缓存.Memcache.redis缓存 Ref: [Laravel] 09 - Func ...
- Oracle:Redhat 7.4+Oracle Rac 11.2.0.4 执行root.sh报错处理
一.报错信息 二.原因分析 因为RHEL 7使用systemd而不是initd运行进程和重启进程,而root.sh通过传统的initd运行ohasd进程 三.解决办法 在RHEL 7中ohasd需要被 ...
- 8.0.11版本的mysql更改root密码
- phpize 扩展GD库 安装 ! 环境--centos 7 +nginx 1.7.11+php 5.6.7
使用phpize编译GD库安装,先安装前置库libjpeg libpng zlib freetype等 都是下面php编译的几个选项 先看php编译的选项: --with-gd=DIR ...
- hexo 博客支持PWA和压缩博文
目标网站 https://blog.rmiao.top/ PWA yarn add hexo-offline 然后在root config.yml里新增 # offline config passed ...
- Vmware Workstation实现CentOS6.10_x64 下ORACLE RAC 11.2.0.4的搭建
想必大家在学习ORACLE 11g时,都想搭建一个RAC的实验环境.在搭建RAC实验环境时,会碰到诸如IP怎么规划.虚拟机环境下怎么共享磁盘.ASM磁盘创建,以及安装过程中会遇到这样那样的问题.搭建一 ...
- 改进动态设置query cache导致额外锁开销的问题分析及解决方法-mysql 5.5 以上版本
改进动态设置query cache导致额外锁开销的问题分析及解决方法 关键字:dynamic switch for query cache, lock overhead for query cach ...
随机推荐
- 《Python 二三事》——python学习必看(转载)
面向初学者介绍Python相关的一些工具,以及可能遇到的常见问题. 原文出处 原文作者:八八年出生的男性,互联网上常用id是 jagttt .目前正从事 IT 行业的工作.业余爱好是动漫游加电 ...
- centos lnmp 安装笔记
[root@host]# chkconfig nginx on [root@host]# service nginx start [root@host]# service nginx stop [ro ...
- asp.net中后台javaScrip的使用
ClientScriptManager csm = Page.ClientScript; //Script标记靠近<form>标签 //csm.Register ...
- phpcms get标签说明
{pc:get sql="SELECT * FROM phpcms_member" cache="3600" page="$page" db ...
- inline-block间隔问题
使用inline-block实现一个类似float布局效果,但是inline-block的元素间会存在“4px”的空白间距. span { display: inline-block; width: ...
- MySQL存储过程实例
一.创建MySQL数据库函数 TCC:无参数,查询fruit表中的所有数据 : TAA:两个参数,查询fruit总共有多少行:查询ids为某个值时水果表的数据 TDD:两个参数,查询ids不等于某个值 ...
- iscc2016-好长的字符串
Vm0wd2QyVkhVWGhVYmxKV1YwZDRXRmxVUm5kVlJscHpXa2M1VjFKdGVGWlZNbmhQWVd4YWMxZHViRmROYWxaeVdWZDRZV014WkhG ...
- UnixODBC
UnixODBC下载安装地址:http://www.unixodbc.org/ DOWNLOAD Distribution Format unixODBC is currently availible ...
- NSString 练习
//将“⽂文艺⻘青年”改成“213⻘青年”. NSString *str = @"文艺青年"; NSString *str1 = [str stringByRepl ...
- MySQL ubuntu启动
service mysql start 启动 service mysql restart 重启 service mysql stop 停止 mysql -uroot -ppassword 登入mysq ...