[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 ...
随机推荐
- 4 - 执行TestNG
TestNG以如下几种方式被调用 命令行 ant Eclipse IntelliJ's IDEA 这部分对如何使用命令行方式调用TestNG进行阐述. 假设TestNG已经在你的classpath中, ...
- [r]Setting up Django and your web server with uWSGI and nginx
Setting up Django and your web server with uWSGI and nginx This tutorial is aimed at the Django user ...
- 嵌套JSON 取出name与value
好久不用都忘了 mark下 $.each( { name: "John", lang: "JS" }, function(i, n){ alert( &qu ...
- 转:Win7 IIS7应用PHP Manager使用FastCGI通道快速部署PHP支持
原文来自于:http://www.jb51.net/os/windows/62390.html 正常情况下,我们在Windows系统中部署WEB服务器(iis)支持PHP是采用ISAPI通道.参照这篇 ...
- 如何更好辨认House of hello恶搞包的真假
相信很多朋友都知道houseofhello恶搞包这个品牌,甚至很多朋友都买过,首先呢,她是恶搞包,算自主品牌,它无淘宝店,更没有所谓的香港实体店.因为这品牌受到广大朋友的狂热,导致无数仿品的出现,淘宝 ...
- mapreduce (五) MapReduce实现倒排索引 修改版 combiner是把同一个机器上的多个map的结果先聚合一次
(总感觉上一篇的实现有问题)http://www.cnblogs.com/i80386/p/3444726.html combiner是把同一个机器上的多个map的结果先聚合一次现重新实现一个: 思路 ...
- 终端上设置git
http://blog.163.com/xianfuying@126/blog/static/21960005201181482518631/ 在-/.ssh的位置vi id_rsa.pub 拷贝的时 ...
- 玩玩TCPCOPY+ intercept+mysql-replay-module(未成功)
TCPCOPY+ intercept这两个模拟流量转发倒简单. 但,想实现一个mysql-replay-module模块时,失败了.(我现在仔细想想,这个方案,在我们现在的场景里,实用性不大,但弄好点 ...
- ARM Cortex M3系列GPIO口介绍(工作方式探讨)
一.Cortex M3的GPIO口特性 在介绍GPIO口功能前,有必要先说明一下M3的结构框图,这样能够更好理解总线结构和GPIO所处的位置. Cortex M3结构框图 从图中可以看出 ...
- struts2.0 struts.xml配置文件详解
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN&quo ...