Skip to content

Commit

Permalink
Merge pull request Tencent#45 from Maizify/dev
Browse files Browse the repository at this point in the history
add `vConsole.version` and `xhr._noVConsole` and update UI font family
  • Loading branch information
Maizify authored Jul 13, 2016
2 parents af00de3 + 0e153f6 commit 93ef49f
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
English | [简体中文](./CHANGELOG_CN.md)

#### V2.x.x (2016-07-xx)

- [FEATURE] Add `vConsole.version` property.
- [FEATURE] Add `xhr._noVConsole` property to `XMLHttpRequest` objects to customize whether a XHR should display in Network tab.


#### V2.1.0 (2016-06-29)

- [FEATURE] Add `vConsole.tool` & `vConsole.$` helper functions, see [Helper Functions](./doc/helper_functions.md).
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[English](./CHANGELOG.md) | 简体中文

#### V2.x.x (2016-07-xx)

- 【特性】新增 `vConsole.version` 属性,以获取当前版本号。
- 【特性】新增 `XMLHttpRequest``xhr._noVConsole` 属性,以控制一个网络请求是否显示在 Network tab 中。


#### v2.1.0 (2016-06-29)

- 【特性】新增 `vConsole.tool``vConsole.$` 辅助函数,请查阅[辅助函数](./doc/helper_functions_CN.md)
Expand Down
6 changes: 3 additions & 3 deletions dist/vconsole.min.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions doc/public_properties_methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ Some useful vConsole properties and methods are available for plugin development
## Properties


### vConsole.version

The current version of vConsole.

- Readonly
- Type: string

Example:

```javascript
vConsole.version // => "2.1.0"
```


### vConsole.activedTab

The actived tab's plugin id.
Expand Down
14 changes: 14 additions & 0 deletions doc/public_properties_methods_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ vConsole 提供一些公共属性字段、函数方法,以便开发插件。
## 属性


### vConsole.version

当前 vConsole 的版本号。

- 只读
- 类型:string

例子:

```javascript
vConsole.version // => "2.1.0"
```


### vConsole.activedTab

当前激活的 tab 的 plugin id。
Expand Down
16 changes: 16 additions & 0 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,20 @@ Supported tabs:
```


## Others

### Network

All `XMLHttpRequest` requests will be displayed in Network tab by default.

To prevent the display, add `_noVConsole = true` to XHR object:

```javascript
var xhr = new XMLHttpRequest();
xhr._noVConsole = true; // now this request would not be displayed in tab
xhr.open("GET", 'http://example.com/');
xhr.send();
```


[Goto: Documentation Index](./a_doc_index.md)
16 changes: 16 additions & 0 deletions doc/tutorial_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,20 @@ console.log('[system] bar');
```


## 其他

### Network 网络

所有 `XMLHttpRequest` 请求都会被显示到 Network tab 中。

若不希望一个请求显示在面板中,可添加属性 `_noVConsole = true` 到 XHR 对象中:

```javascript
var xhr = new XMLHttpRequest();
xhr._noVConsole = true; // 不会显示到 tab 中
xhr.open("GET", 'http://example.com/');
xhr.send();
```


[前往:文档索引](./a_doc_index_CN.md)
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vconsole",
"version": "2.1.0",
"version": "2.1.1-pre",
"description": "A lightweight, extendable front-end developer tool for mobile web page.",
"homepage": "https://github.com/WechatFE/vConsole",
"main": "dist/vconsole.min.js",
Expand All @@ -24,16 +24,17 @@
"babel-plugin-add-module-exports": "^0.1.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-3": "^6.5.0",
"chai": "^3.5.0",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"html-loader": "^0.4.3",
"jsdom": "^9.2.1",
"json-loader": "^0.5.4",
"less": "^2.5.3",
"less-loader": "^2.2.3",
"style-loader": "^0.13.1",
"webpack": "~1.12.11",
"jsdom": "^9.2.1",
"mocha": "^2.5.3",
"chai": "^3.5.0"
"style-loader": "^0.13.1",
"webpack": "~1.12.11"
},
"author": "WechatFE Team",
"license": "MIT"
Expand Down
2 changes: 2 additions & 0 deletions src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @author WechatFE
*/

import pkg from '../../package.json';
import * as tool from '../lib/tool.js';
import $ from '../lib/query.js';
import './core.less';
Expand All @@ -17,6 +18,7 @@ class VConsole {
constructor() {
var that = this;

this.version = pkg.version;
this.html = tpl;
this.$dom = null;
this.activedTab = '';
Expand Down
1 change: 1 addition & 0 deletions src/core/core.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#__vconsole {

font-size: 13px;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;

/* global */

Expand Down
4 changes: 3 additions & 1 deletion src/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ class VConsoleNetworkTab extends VConsolePlugin {
item.response = XMLReq.response;
}

that.updateRequest(id, item);
if (!XMLReq._noVConsole) {
that.updateRequest(id, item);
}
return _onreadystatechange.apply(XMLReq, arguments);
};

Expand Down
3 changes: 3 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ module.exports = {
test: /\.less$/,
loader: 'style!css!less'
// loader: ExtractTextPlugin.extract('style-loader', 'css-loader!less-loader') // 将css独立打包
},
{
test: /\.json$/, loader: 'json'
}
]
},
Expand Down

0 comments on commit 93ef49f

Please sign in to comment.