codecamp

PWA介绍

编辑器使用了PWA技术,具体支持了:

离线缓存

将编辑器数据缓存到server worker中,没有网络时也可以正常使用编辑器

添加到桌面图标

在chrome中按F12,打开开发者工具

打开 Application 面板上的 Manifest,点击 Add to homescreen 按钮

这样就可以将编辑器添加到主屏幕。您会在网址栏下方看到“add this site to your shelf”消息,如以下图所示

pwa

更新缓存

每当Wonder发布了新的版本,您只需要刷新几次编辑器页面,并保证刷新间隔在5秒以上,就可以获得最新版本

Wonder介绍
进入编辑器
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }