PWA All In One

chrome://apps/

PWA

Progressive Web App

  1. 可安装,添加到主屏
  2. 离线使用
  3. 轻量,快速
  4. 基于 Web 技术一套代码多端复用(移动端,桌面端,浏览器)

https://web.dev/pwa-checklist/

https://web.dev/progressive-web-apps/

https://developers.google.com/web/updates/2015/12/getting-started-pwa

PWA codelabs

https://developers.google.com/web/fundamentals/codelabs/your-first-pwapp

https://codelabs.developers.google.com/

PWABuilder

Quickly and easily turn your website into an app!

https://www.pwabuilder.com/

https://github.com/pwa-builder

$ git clone https://github.com/pwa-builder/pwa-starter.git

https://components.pwabuilder.com/

demos

Pinterest

https://www.pinterest.com/

  1. 安装后,全屏打开独立的窗口

  1. 系统应用启动栏可以看到独立的 App Logo

  1. 可卸载,可重新在 浏览器中打开

PWA bug

https://pwa.xgqfrms.xyz/pwa-app/public/index.html

https://github.com/xgqfrms/pwa

fetch(`https://api.darksky.net/forecast/1dda89e902ce89b77ed2412eac3026d8/40.7720232,-73.9732319`)
.then(response => response.json())
.then(json => {
connsole.log(`json = ${json}`);
return json || null;
})
.catch(err => console.error(err));


/**
* Get's the latest forecast data from the network.
*
* @param {string} coords Location object to.
* @return {Object} The weather forecast, if the request fails, return null.
*/
function getForecastFromNetwork(coords) {
const url = `https://api.darksky.net/forecast/1dda89e902ce89b77ed2412eac3026d8/${coords}`;
// const url = `/forecast/${coords}`;
return fetch(url)
.then((response) => {
return response.json();
})
.then(json => {
console.log(`network json`, json);
})
.catch((err) => {
console.error('Error getting data from cache', err);
return null;
});
} /**
* Get's the cached forecast data from the caches object.
*
* @param {string} coords Location object to.
* @return {Object} The weather forecast, if the request fails, return null.
*/
function getForecastFromCache(coords) {
// CODELAB: Add code to get weather forecast from the caches object.
if (!('caches' in window)) {
return null;
}
// API ??? bug
// api_conditions_url = "https://api.darksky.net/forecast/" + DARKSKY_API_KEY + "/" + GPS_COORDS + "?units=auto"
const url = `https://api.darksky.net/forecast/1dda89e902ce89b77ed2412eac3026d8/${coords}`;
// const url = `${window.location.origin}/forecast/${coords}`;
return caches.match(url)
.then((response) => {
if (response) {
return response.json();
}
return null;
})
.then(json => {
console.log(`cache json`, json);
})
.catch((err) => {
console.error('Error getting data from cache', err);
return null;
});
}

refs

https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps

https://www.smashingmagazine.com/2016/08/a-beginners-guide-to-progressive-web-apps/

PWA examples

https://www.simicart.com/blog/progressive-web-apps-examples/



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


PWA All In One的更多相关文章

  1. 说说 PWA 和微信小程序--Progressive Web App

    作者:云图图链接:https://zhuanlan.zhihu.com/p/22578965来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 利益相关:微信小用户,谷歌小 ...

  2. [PWA] Keynote: Progressive Web Apps across all frameworks

    PWA: Add to home screen Angular Universal Server side rendering: for achieving better proference on ...

  3. PWA - 渐进式网络应用初认识

    Progressive Web Apps 简称PWA,是一种接近原生用户体验的渐进增强的web-app.从浏览器演进而来,沉浸式的体验,改进web的性能低下等.是Google 在2015年提出,今年才 ...

  4. 轻松把你的项目升级到PWA

    什么是PWA PWA(Progressive Web Apps,渐进式网页应用)是Google在2015年推出的项目,致力于通过web app获得类似native app体验的网站. 优点 1.无需客 ...

  5. PWA学习心得

    PWA学习心得 一.什么是PWA Progressive  Web  App , (渐进式增强 WEB 应用) 简称 PWA ,是提升WebApp的体验的一种新方法,能给用户原生应用的体验. PWA ...

  6. hexo 博客支持PWA和压缩博文

    目标网站 https://blog.rmiao.top/ PWA yarn add hexo-offline 然后在root config.yml里新增 # offline config passed ...

  7. 震撼功能:逐浪CMS全面支持PWA移动生成意指未来

    Progressive Web App, 简称 PWA,是提升 Web App 的体验的一种新方法,能给用户原生应用的体验. PWA 能做到原生应用的体验不是靠特指某一项技术,而是经过应用一些新技术进 ...

  8. 新事物学习---Chrome上使用PWA

    PWA是什么 PWA(Progressive Web Apps)是 Google 最近在提的一种 Web App 形态 (或者如 Wikipedia 所称的"软件开发方法").PW ...

  9. Angular 学习笔记 ( PWA + App Shell )

    PWA (Progressive Web Apps) 是未来网页设计的方向. 渐进式网站. Angular v5 开始支持 pwa 网站 (所谓支持意思是说有一些 build in 的方法和规范去实现 ...

  10. PWA初体验

    一.前言 现在市面上的Native  APP成千上万个,各种应用商店里面的APP琳琅满目.原生的APP下载到手机上之后,用户就可以获取一个方便的入口,体验上也十分顺畅.但是再好的事物难免有点缺点: 1 ...

随机推荐

  1. Vue基础之Vue组件

    Vue基础之Vue组件 // 组件是可以复用的Vue实例! // 可以把经常重复的功能封装为组件!

  2. 源码 redis 分布式锁

    https://github.com/SPSCommerce/redlock-py/tree/master/redlock

  3. Salt (cryptography)

    Salt (cryptography) Here is an incomplete example of a salt value for storing passwords. This first ...

  4. 小鹏汽车技术中台实践 :微服务篇 InfoQ 今天 以下文章来源于InfoQ Pro

    小鹏汽车技术中台实践 :微服务篇 InfoQ  今天 以下文章来源于InfoQ Pro

  5. libevent之基于socket的bufferevent

    基于socket的bufferevent由一个socket的传输层和read/write buffer组成.区别于常规的event,当socket可读或者可写时会回调用户的callback,buffe ...

  6. ctsc选课

    CTSC 1997 大学实行学分制.每门课程都有一定的学分,学生只要选修了这门课并通过考核就能获得相应学分.学生最后的学分是他选修各门课的学分总和. 每个学生都要选择规定数量的课程.有些课程可以直接选 ...

  7. Spark日志,及设置日志输出级别

    Spark日志,及设置日志输出级别 1.全局应用设置 2.局部应用设置日志输出级别 3.Spark log4j.properties配置详解与实例(摘录于铭霏的记事本) 文章内容来源: 作者:大葱拌豆 ...

  8. MongoDB:原来我如此简单

    为什么要使用 MongoDB 张三大学毕业设计题目是<XXX博客论坛>,他在存储用户评论的时候遇到了一个问题:这些评论数据量非常大,但是价值不是很大,如果存储在 MySQL 数据库中就会浪 ...

  9. C++隐式推导-auto关键词

    总述 C++中有一个关键字,它不进行显式声明,而进行隐式推导,auto可以在声明变量时根据变量初始值的类型自动为此变量选择匹配的类型.C++语言类似的关键字还有decltype. 如何评价 C++ 1 ...

  10. 最好的IDEA debug长文?看完我佛了

    前言 你好,我是A哥(YourBatman). 最近写了几篇IntelliJ IDEA系列的文章,反响蛮好.我想了下,因为并非是分享什么破解方法.推荐插件.主题这种蛋炒饭式哗众取宠的文章,而是真实对工 ...