8000 feature #26668 [WebProfilerBundle] Live duration of AJAX request (ost… · symfony/symfony@5b6ff93 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5b6ff93

Browse files
committed
feature #26668 [WebProfilerBundle] Live duration of AJAX request (ostrolucky)
This PR was merged into the 4.1-dev branch. Discussion ---------- [WebProfilerBundle] Live duration of AJAX request | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26645 | License | MIT | Doc PR | - This will spit out current calculated AJAX request duration, before it finishes. Solves my DX issue about not knowing if request is still in progress. ![peek 2018-03-25 15-07](https://user-images.githubusercontent.com/496233/37875667-f45376a8-3042-11e8-87e5-24416b8ba670.gif) Commits ------- eb6974d [WebProfilerBundle] Live duration of AJAX request
2 parents 5b27c2f + eb6974d commit 5b6ff93

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@
168168
durationCell.textContent = 'n/a';
169169
row.appendChild(durationCell);
170170
171+
request.liveDurationHandle = setInterval(function() {
172+
durationCell.textContent = (new Date() - request.start) + 'ms';
173+
}, 100);
174+
171175
row.className = 'sf-ajax-request sf-ajax-request-loading';
172176
tbody.insertBefore(row, tbody.firstChild);
173177
@@ -176,6 +180,8 @@
176180
177181
var finishAjaxRequest = function(index) {
178182
var request = requestStack[index];
183+
clearInterval(request.liveDurationHandle);
184+
179185
if (!request.DOMNode) {
180186
return;
181187
}

0 commit comments

Comments
 (0)
0