提交 b4d09efc 编写于 作者: DCloud_JSON's avatar DCloud_JSON

更新 解决APP端不支持console.time的问题,方便计时调试性能

上级 d6e6c02d
...@@ -5,6 +5,31 @@ ...@@ -5,6 +5,31 @@
import uniIm from '@/uni_modules/uni-im/sdk/index.js'; import uniIm from '@/uni_modules/uni-im/sdk/index.js';
// 3.引入扩展插件(项目默认引入了,扩展插件uniImMsgReader用于展示消息是否已读) // 3.引入扩展插件(项目默认引入了,扩展插件uniImMsgReader用于展示消息是否已读)
import MsgReaderExtension from '@/uni_modules/uni-im-msg-reader/extension.js' import MsgReaderExtension from '@/uni_modules/uni-im-msg-reader/extension.js'
// 解决APP端不支持console.time的问题
const consoleTimeObj = {}
console.time = function (name) {
consoleTimeObj[name] = Date.now()
}
console.timeEnd = function (name,fun) {
const time = Date.now() - consoleTimeObj[name]
if (time > 0) {
// if (time > 3) {
// console.error(name + ':', time + 'ms')
// }else if(time > 1){
// console.warn(name + ':', time + 'ms')
// }
// else{
// console.log(name + ':', time + 'ms')
// }
// // fun && fun(time)
// // console.log('find-'+this.constructor.name,new Error().stack)
} else {
// console.log(name + ':', time + 'ms')
}
}
export default { export default {
onLaunch: async function() { onLaunch: async function() {
console.log('App Launch'); console.log('App Launch');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册