Skip to content

Commit

Permalink
Merge pull request #276 from apple01150525/master
Browse files Browse the repository at this point in the history
feature: 小说阅读器添加白屏率和目录渲染失败率日志打点(#275)
  • Loading branch information
apple01150525 authored Sep 26, 2018
2 parents 8592723 + ec4c293 commit dbcc05f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
19 changes: 19 additions & 0 deletions components/mip-shell-xiaoshuo/common/log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* file: 小说 shell 统一日志发送
* author: JennyL <[email protected]>
*/

/**
* 发送日志
* @param {string} type 日志类型
* @param {Object} info 日志信息
*/
export function sendWebbLog (type, info) {
let data = Object.assign({info}, {
dim: {
from: 'novel'
}
})
let eventName = type + '-log'
MIP.viewer.sendMessage(eventName, data)
}
15 changes: 14 additions & 1 deletion components/mip-shell-xiaoshuo/feature/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import state from '../common/state'
import {getCurrentWindow} from '../common/util'
import {sendWebbLog} from './../common/log' // 日志

let util = MIP.util
class Catalog {
constructor (config, book) {
Expand Down Expand Up @@ -145,6 +147,7 @@ class Catalog {
.then(data => {
this.renderCatalogCallBack(data, catalogs)
}).catch(err => {
this.catalogFailMessageEvent()
console.error(new Error('网络异常'), err)
this.categoryList = false
})
Expand Down Expand Up @@ -200,7 +203,17 @@ class Catalog {
}
return $catalogSidebar
}

/**
* 发送目录渲染失败日志
*
* @private
*/
catalogFailMessageEvent () {
sendWebbLog('stability', {
msg: 'catalogRenderFailed',
renderMethod: 'async'
})
}
/**
* 目录消失
*
Expand Down
1 change: 0 additions & 1 deletion components/mip-shell-xiaoshuo/feature/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class footer {
nextButton.classList.remove('disabled')
if (!nextHref) nextButton.classList.add('disabled')
}

// 显示底bar
show (shellElement) {
let footer = this
Expand Down
1 change: 0 additions & 1 deletion components/mip-shell-xiaoshuo/mip-shell-xiaoshuo.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default class MipShellXiaoshuo extends MIP.builtinComponents.MipShell {
// 处理浏览器上下滚动边界,关闭弹性
this._scrollBoundary()
}

// 基类方法:绑定页面可被外界调用的事件。
// 如从跳转后的iframe颜色设置,通知所有iframe和根页面颜色改变
bindAllEvents () {
Expand Down

0 comments on commit dbcc05f

Please sign in to comment.