Skip to content

Commit

Permalink
defer with timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Aug 24, 2020
1 parent 83989e5 commit f654545
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ResourceStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ public function generateHtmlIncludes($for = self::TYPE_CSS, int $priority = null
{
if(is_int($options['defer']))
{
$attrs['src'] = 'src=\'data:text/javascript;base64,'
. base64_encode('setTimeout(function(){' . $inlineContent . '},' . $options['defer'] . ');') . '\'';
$options['defer'] = true;
$inlineContent = 'setTimeout(function(){' . $inlineContent . '},' . $options['defer'] . ');';
unset($options['defer']);
}
else
{
$attrs[] = 'src=\'data:text/javascript;base64,' . base64_encode($inlineContent) . '\'';
$inlineContent = null;
}
$inlineContent = null;
}

foreach($options as $opt => $optV)
Expand Down

0 comments on commit f654545

Please sign in to comment.