Cordova 热更新处理(三):增长 listen 处理

20170123 热更新优化

一、给每一个hot uopdate 产生的事件增长一个 listen
    addEventListener 的 function 第一个参数老是 isTrusted:false,
    第二个参数总数 undefined,以上 listen 无法统一在一块儿
    待之后处理 addEventListener 的 function 参数
二、第一轮: 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)
三、修改 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)
四、退出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)
五、计划在 chcp_updateIsReadyToInstall 事件后,弹出提示,主动退出 app
    *** 待下次处理
相关文章
相关标签/搜索