Add: Disable performance timing setting

This commit is contained in:
surunzi
2016-05-21 19:06:28 +08:00
parent 6d26c7434f
commit 71fb6d9197
3 changed files with 45 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "eruda",
"version": "0.5.5",
"version": "0.5.6",
"description": "Console for Mobile Browsers",
"main": "dist/eruda.js",
"scripts": {

View File

@@ -29,7 +29,6 @@ export default class Network extends Tool
{
super.show();
this._getPerformanceTimingData();
this._render();
}
overrideXhr()
@@ -249,7 +248,10 @@ export default class Network extends Tool
{
var cfg = this.config = config.create('eruda-network');
cfg.set(util.defaults(cfg.get(), {overrideXhr: true}));
cfg.set(util.defaults(cfg.get(), {
disablePerformance: false,
overrideXhr: true
}));
if (cfg.get('overrideXhr')) this.overrideXhr();
@@ -264,17 +266,23 @@ export default class Network extends Tool
var settings = this._parent.get('settings');
settings.text('Network')
.add(cfg, 'overrideXhr', 'Catch Ajax Requests')
.add(cfg, 'disablePerformance', 'Disable Performance Timing')
.separator();
}
_render()
{
if (!this.active) return;
this._renderHtml(this._tpl({
data: this._performanceTimingData,
timing: this._performanceTiming,
requests: this._requests
}));
var renderData = {requests: this._requests};
if (!this.config.get('disablePerformance'))
{
this._getPerformanceTimingData();
renderData.data = this._performanceTimingData;
renderData.timing = this._performanceTiming;
}
this._renderHtml(this._tpl(renderData));
}
_renderHtml(html)
{

View File

@@ -1,31 +1,33 @@
<div class="eruda-performance-timing">
<div class="eruda-inner-wrapper">
{{#each data}}
<div class="eruda-bar">
<span style="position:relative;left:{{start}}%;width:{{len}}%">{{name}}({{duration}}ms)</span>
</div>
{{/each}}
</div>
</div>
<div class="eruda-performance-timing-data">
<table>
<thead>
<tr>
<th>Name</th>
<th>Time(ms)</th>
</tr>
</thead>
<tbody>
{{#each timing}}
<tr>
<td>{{@key}}</td>
<td>{{this}}</td>
</tr>
{{#if timing}}
<div class="eruda-performance-timing">
<div class="eruda-inner-wrapper">
{{#each data}}
<div class="eruda-bar">
<span style="position:relative;left:{{start}}%;width:{{len}}%">{{name}}({{duration}}ms)</span>
</div>
{{/each}}
</tbody>
</table>
</div>
</div>
</div>
<div class="eruda-performance-timing-data">
<table>
<thead>
<tr>
<th>Name</th>
<th>Time(ms)</th>
</tr>
</thead>
<tbody>
{{#each timing}}
<tr>
<td>{{@key}}</td>
<td>{{this}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/if}}
<ul class="eruda-requests">
{{#each requests}}