Same name in other branches
- 5.0.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::asyncJs()
- 6.0.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::asyncJs()
- 8.x-4.x advagg_mod/src/EventSubscriber/InitSubscriber.php \Drupal\advagg_mod\EventSubscriber\InitSubscriber::asyncJs()
Apply CSS defer actions.
Parameters
\Symfony\Component\HttpKernel\Event\FilterResponseEvent $response: The response event object.
File
-
advagg_mod/
src/ EventSubscriber/ InitSubscriber.php, line 232
Class
- InitSubscriber
- Perform initialization tasks for advagg_mod.
Namespace
Drupal\advagg_mod\EventSubscriberCode
public function asyncJs(FilterResponseEvent $response) {
// Skip if not enabled.
if (!$this->config
->get('js_async') || $this->config
->get('js_defer')) {
return;
}
$response = $response->getResponse();
// Only process Html Responses.
if (!$response instanceof HtmlResponse) {
return;
}
$content = $this->jsAsyncer
->async($response->getContent());
$response->setContent($content);
}