Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.

Commit dae6ba3

Browse files
author
James Ellis
committed
Add add_async_timing option to turn off/on timing
1 parent 1e8458b commit dae6ba3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Backend.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public function includeInHTML($html)
251251
}
252252

253253
// add scripts
254-
if (strpos($html, self::LOADER_SCRIPT_PLACEHOLDER)) {
254+
if (strpos($html, self::LOADER_SCRIPT_PLACEHOLDER) !== false) {
255255
// Attempt to replace the placeholder comment with our scripts
256256
$script_requirements .= "<!-- :) -->";
257257
$html = str_replace(self::LOADER_SCRIPT_PLACEHOLDER, $script_requirements, $html);
@@ -278,7 +278,9 @@ public function includeInHTML($html)
278278

279279
$end = microtime(true);
280280
$time = round($end - $start, 7);
281-
$html .= "<!-- {$time} -->\n";
281+
if($add_async_timing = Config::inst()->get( Requirements::class, 'add_async_timing' )) {
282+
$html .= "<!-- {$time} -->\n";
283+
}
282284

283285
return $html;
284286
}
@@ -396,7 +398,9 @@ private function includeInHTMLViaDOMDocument($html) {
396398
$html = $dom->saveHTML();
397399
libxml_clear_errors();
398400

399-
$html .= "<!-- {$time} -->\n";
401+
if($add_async_timing = Config::inst()->get( Requirements::class, 'add_async_timing' )) {
402+
$html .= "<!-- {$time} -->\n";
403+
}
400404

401405
return $html;
402406
}

0 commit comments

Comments
 (0)