Skip to content

Commit f654545

Browse files
committed
defer with timeout
1 parent 83989e5 commit f654545

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/ResourceStore.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,14 @@ public function generateHtmlIncludes($for = self::TYPE_CSS, int $priority = null
6767
{
6868
if(is_int($options['defer']))
6969
{
70-
$attrs['src'] = 'src=\'data:text/javascript;base64,'
71-
. base64_encode('setTimeout(function(){' . $inlineContent . '},' . $options['defer'] . ');') . '\'';
72-
$options['defer'] = true;
70+
$inlineContent = 'setTimeout(function(){' . $inlineContent . '},' . $options['defer'] . ');';
71+
unset($options['defer']);
7372
}
7473
else
7574
{
7675
$attrs[] = 'src=\'data:text/javascript;base64,' . base64_encode($inlineContent) . '\'';
76+
$inlineContent = null;
7777
}
78-
$inlineContent = null;
7978
}
8079

8180
foreach($options as $opt => $optV)

0 commit comments

Comments
 (0)