vconsole
Advanced tools
Comparing version 3.1.0 to 3.2.0
[English](./CHANGELOG.md) | 简体中文 | ||
#### V3.1.0-dev (2017-12-27) | ||
#### V3.2.0 (2018-04-10) | ||
- 【特性】支持 `console.time()` 及 `console.timeEnd()`。 | ||
- 【特性】新增 `disableLogScrolling` 配置项(`vConsole.option`),用于禁止新日志引起的自动滚动到底部。 | ||
- 【修复】修复初始化后立即调用 `setOption` 引起的错误。 | ||
- 【修复】修复 cookies 显示错误的问题。 | ||
- 【修复】修复 "Uncaught InvalidStateError" 错误。 (by @fireyy) | ||
#### V3.1.0 (2017-12-27) | ||
- 【特性】新增 `vConsole.showSwitch()` 及 `vConsole.hideSwitch()` 方法,请查阅[公共属性及方法](./doc/public_properties_methods_CN.md)。 | ||
@@ -6,0 +15,0 @@ - 【特性】新增 `onReady` 及 `onClearLog` 回调方法,位于 `vConsole.option`。 |
English | [简体中文](./CHANGELOG_CN.md) | ||
#### V3.1.0-dev (2017-12-27) | ||
#### V3.2.0 (2018-04-10) | ||
- [FEATURE] Support `console.time()` and `console.timeEnd()`. | ||
- [FEATRUE] Add `disableLogScrolling` (in `vConsole.option`). | ||
- [FIX] Fix `setOption()` error. | ||
- [FIX] Fix cookies' value wrong display. | ||
- [FIX] Fix "Uncaught InvalidStateError". (by @fireyy) | ||
#### V3.1.0 (2017-12-27) | ||
- [FEATURE] Add `vConsole.showSwitch()` and `vConsole.hideSwitch()` methods, see [Public Properties & Methods](./doc/public_properties_methods.md). | ||
@@ -6,0 +15,0 @@ - [FEATURE] Add `onReady` and `onClearLog` callback function to `vConsole.option`. |
@@ -19,3 +19,3 @@ 公共属性及方法 | ||
```javascript | ||
vConsole.version // => "3.0.0" | ||
vConsole.version // => "3.1.0" | ||
``` | ||
@@ -31,7 +31,9 @@ | ||
键名 | 类型 | 可选 | 默认值 | 描述 | ||
-------------- | -------- | -------- | ------------------------------------------- | ------------------- | ||
defaultPlugins | Array | true | ['system', 'network', 'element', 'storage'] | 需要自动初始化并加载的内置插件。 | ||
onReady | Function | true | | 回调方法,当 vConsole 完成初始化并加载完内置插件后触发。 | ||
maxLogNumber | Number | true | 1000 | 超出上限的日志会被自动清除。 | ||
键名 | 类型 | 可选 | 默认值 | 描述 | ||
--------------------- | -------- | -------- | ------------------------------------------- | ------------------- | ||
defaultPlugins | Array | true | ['system', 'network', 'element', 'storage'] | 需要自动初始化并加载的内置插件。 | ||
onReady | Function | true | | 回调方法,当 vConsole 完成初始化并加载完内置插件后触发。 | ||
onClearLog | Function | true | | 回调方法,点击 Log 或 System 面板的 "Clear" 按钮后出发。 | ||
maxLogNumber | Number | true | 1000 | 超出上限的日志会被自动清除。 | ||
disableLogScrolling | Boolean | true | | 若为 `false`,有新日志时面板将不会自动滚动到底部。 | ||
@@ -38,0 +40,0 @@ 例子: |
@@ -19,3 +19,3 @@ Public Properties & Methods | ||
```javascript | ||
vConsole.version // => "3.0.0" | ||
vConsole.version // => "3.1.0" | ||
``` | ||
@@ -31,7 +31,9 @@ | ||
Key | Type | Optional | Default value | Description | ||
-------------- | -------- | -------- | ------------------------------------------- | ------------------- | ||
defaultPlugins | Array | true | ['system', 'network', 'element', 'storage'] | Listed built-in plugins will be inited and loaded into vConsole. | ||
onReady | Function | true | | Trigger after vConsole is inited and default plugins is loaded. | ||
maxLogNumber | Number | true | 1000 | Overflow logs will be removed from log tabs. | ||
Key | Type | Optional | Default value | Description | ||
--------------------- | -------- | -------- | ------------------------------------------- | ------------------- | ||
defaultPlugins | Array | true | ['system', 'network', 'element', 'storage'] | Listed built-in plugins will be inited and loaded into vConsole. | ||
onReady | Function | true | | Trigger after vConsole is inited and default plugins is loaded. | ||
onClearLog | Function | true | | Trigger after click "Clear" button in Log and System panel. | ||
maxLogNumber | Number | true | 1000 | Overflow logs will be removed from log tabs. | ||
disableLogScrolling | Boolean | true | | If `false`, panel will not scroll to bottom while printing new logs. | ||
@@ -38,0 +40,0 @@ Example: |
{ | ||
"name": "vconsole", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "A lightweight, extendable front-end developer tool for mobile web page.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Tencent/vConsole", |
@@ -499,2 +499,3 @@ /* | ||
// end init | ||
plugin.isReady = true; | ||
plugin.trigger('ready'); | ||
@@ -509,3 +510,5 @@ } | ||
for (let id in this.pluginList) { | ||
this.pluginList[id].trigger(eventName); | ||
if (this.pluginList[id].isReady) { | ||
this.pluginList[id].trigger(eventName); | ||
} | ||
} | ||
@@ -520,3 +523,3 @@ } | ||
let plugin = this.pluginList[pluginName]; | ||
if (plugin) { | ||
if (!!plugin && plugin.isReady) { | ||
plugin.trigger(eventName); | ||
@@ -696,3 +699,3 @@ } | ||
// trigger plugin event | ||
this._triggerPluginEvent(this.activedTab, 'hide'); | ||
this.activedTab && this._triggerPluginEvent(this.activedTab, 'hide'); | ||
this.activedTab = tabID; | ||
@@ -699,0 +702,0 @@ this._triggerPluginEvent(this.activedTab, 'show'); |
@@ -21,3 +21,4 @@ /* | ||
this.name = name; | ||
this.isReady = false; | ||
this.eventList = {}; | ||
@@ -24,0 +25,0 @@ } |
@@ -160,2 +160,4 @@ /* | ||
window.console.error = this.console.error; | ||
window.console.time = this.console.time; | ||
window.console.timeEnd = this.console.timeEnd; | ||
window.console.clear = this.console.clear; | ||
@@ -168,3 +170,3 @@ this.console = {}; | ||
if (this.isInBottom == true) { | ||
this.scrollToBottom(); | ||
this.autoScrollToBottom(); | ||
} | ||
@@ -179,3 +181,3 @@ } | ||
if (this.isInBottom == true) { | ||
this.scrollToBottom(); | ||
this.autoScrollToBottom(); | ||
} | ||
@@ -224,2 +226,8 @@ } | ||
autoScrollToBottom() { | ||
if (!this.vConsole.option.disableLogScrolling) { | ||
this.scrollToBottom(); | ||
} | ||
} | ||
scrollToBottom() { | ||
@@ -246,2 +254,4 @@ let $content = $.one('.vc-content'); | ||
}); | ||
that.console.time = window.console.time; | ||
that.console.timeEnd = window.console.timeEnd; | ||
that.console.clear = window.console.clear; | ||
@@ -259,2 +269,16 @@ } | ||
const timeLog = {} | ||
window.console.time = function(label) { | ||
timeLog[label] = Date.now(); | ||
}; | ||
window.console.timeEnd = function(label) { | ||
var pre = timeLog[label]; | ||
if (pre) { | ||
console.log(label + ':', (Date.now() - pre) + 'ms'); | ||
delete timeLog[label]; | ||
} else { | ||
console.log(label + ': 0ms'); | ||
} | ||
}; | ||
window.console.clear = (...args) => { | ||
@@ -403,3 +427,3 @@ that.clearLog(); | ||
if (this.isInBottom) { | ||
this.scrollToBottom(); | ||
this.autoScrollToBottom(); | ||
} | ||
@@ -406,0 +430,0 @@ |
@@ -291,3 +291,6 @@ /* | ||
item.readyState = XMLReq.readyState; | ||
item.status = XMLReq.status; | ||
item.status = 0; | ||
if (XMLReq.readyState > 1) { | ||
item.status = XMLReq.status; | ||
} | ||
item.responseType = XMLReq.responseType; | ||
@@ -362,3 +365,3 @@ | ||
item.url = query.shift(); // => ['b=c&d=', '?e'] | ||
if (query.length > 0) { | ||
@@ -375,3 +378,3 @@ item.getData = {}; | ||
if (item.method == 'POST') { | ||
// save POST data | ||
@@ -378,0 +381,0 @@ if (tool.isString(data)) { |
@@ -151,4 +151,4 @@ /* | ||
let item = items[i].split('='); | ||
let name = item[0].replace(/^ /, ''), | ||
value = item[1]; | ||
let name = item.shift().replace(/^ /, ''), | ||
value = item.join('='); | ||
list.push({ | ||
@@ -155,0 +155,0 @@ name: decodeURIComponent(name), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
414742
3408
75