Cordova 热更新处理(三):增加 listen 处理
2017-02-16 12:28
288 查看
20170123 热更新优化
1、给每个hot uopdate 产生的事件增加一个 listen addEventListener 的 function 第一个参数总是 isTrusted:false, 第二个参数总数 undefined,以上 listen 没法统一在一起 待以后处理 addEventListener 的 function 参数 2、第一轮: apk 和 www 内容完全一样 sudo cordova-hcp build sudo cordova build android copy www 到 http://192.168.1.103/hot20170113/www sudo cordova run android 查看 logcat ,收到 chcp_nothingToUpdate,正常!logcat信息如下 01-23 15:21:43.224: I/chromium(5088): [INFO:CONSOLE(72)] "收到事件 444666 events ===={"isTrusted":false}", source: file:///android_asset/www/js/index.js (72) 01-23 15:21:43.224: I/chromium(5088): [INFO:CONSOLE(73)] "收到事件 444666 events ====undefined", source: file:///android_asset/www/js/index.js (73) 01-23 15:21:43.224: I/chromium(5088): [INFO:CONSOLE(74)] "收到事件 chcp_nothingToUpdate ====", source: file:///android_asset/www/js/index.js (74) 3、修改 index.html, sudo cordova-hcp build copy www 到 http://192.168.1.103/hot20170113/www 在手机退出程序,再次运行刚才的 app 查看 logcat ,收到 chcp_updateIsReadyToInstall,正常!logcat信息如下 01-23 15:25:45.214: I/chromium(5088): [INFO:CONSOLE(86)] "收到事件 777666 events ===={"isTrusted":false}", source: file:///data/user/0/io.cordova.hellocordova/files/cordova-hot-code-push-plugin/2017.01.23-15.19.42/www/js/index.js (86) 01-23 15:25:45.214: I/chromium(5088): [INFO:CONSOLE(87)] "收到事件 777666 events ====undefined", source: file:///data/user/0/io.cordova.hellocordova/files/cordova-hot-code-push-plugin/2017.01.23-15.19.42/www/js/index.js (87) 01-23 15:25:45.214: I/chromium(5088): [INFO:CONSOLE(88)] "收到事件 chcp_updateIsReadyToInstall ====", source: file:///data/user/0/io.cordova.hellocordova/files/cordova-hot-code-push-plugin/2017.01.23-15.19.42/www/js/index.js (88) 4、退出app,再次进来app ** 现在 app 已经 update 到和 www 内容完全一样 查看 logcat ,收到 chcp_nothingToUpdate,正常!logcat信息如下 01-23 15:28:49.636: I/chromium(5088): [INFO:CONSOLE(72)] "收到事件 444666 events ===={"isTrusted":false}", source: file:///data/user/0/io.cordova.hellocordova/files/cordova-hot-code-push-plugin/2017.01.23-15.25.31/www/js/index.js (72) 01-23 15:28:49.636: I/chromium(5088): [INFO:CONSOLE(73)] "收到事件 444666 events ====undefined", source: file:///data/user/0/io.cordova.hellocordova/files/cordova-hot-code-push-plugin/2017.01.23-15.25.31/www/js/index.js (73) 01-23 15:28:49.636: I/chromium(5088): [INFO:CONSOLE(74)] "收到事件 chcp_nothingToUpdate ====", source: file:///data/user/0/io.cordova.hellocordova/files/cordova-hot-code-push-plugin/2017.01.23-15.25.31/www/js/index.js (74) 5、计划在 chcp_updateIsReadyToInstall 事件后,弹出提示,主动退出 app *** 待下次处理
相关文章推荐
- 郁闷!ionic中获取ng-model绑定的值为undefined如何解决
- ionic 上拉菜单(ActionSheet)实例代码
- ionic2 tabs使用 Modal底部tab弹出框
- ionic进入多级目录后隐藏底部导航栏(tabs)的完美解决方案
- 简单实现IONIC购物车功能
- ionic隐藏tabs的方法
- Ionic实现页面下拉刷新(ion-refresher)功能代码
- 使用JS轻松实现ionic调用键盘搜索功能(超实用)
- 使用ionic在首页新闻中应用到的跑马灯效果的实现方法
- ionic中列表项增加和删除的实现方法
- Ionic默认的Tabs模板使用实例
- Ionic 2 实现列表滑动删除按钮的方法
- Ionic快速安装教程
- Node.js巧妙实现Web应用代码热更新
- ionic实现滑动的三种方式
- ionic实现带字的toggle滑动组件
- 使用ionic切换页面卡顿的解决方法
- 如何解决IONIC页面底部被遮住无法向上滚动问题
- Ionic如何创建APP项目
- IONIC自定义subheader的最佳解决方案