I have a module I wrote that prints dynamic data for JavaScript variables.
function javascript_api_page_attachments(array &$page) {
$page['#attached']['html_head'][] = [
// The data.
[
'#type' => 'html_tag',
// The HTML tag to add, in this case a tag.
'#tag' => 'script',
// The value of the HTML tag, here we want to end up with alert("Hello world!");.
'#value' => javascript_api_print_parameters(),
],
// A key, to make it possible to recognize this HTML element when altering.
'hello-world'
];}
My problem is when Drupal caches the page.Need to stop caching my pages in drupal.
How can I avoid the output of my module is cached?