yes you could do something like that in your getHTML() method and in hook.js you then prepend on the div:
global $DIC;
if ($a_comp == 'Services/Container' && (int)$_GET['ref_id'] === 1234) {
$DIC->globalScreen()->layout()->meta()->addJs('./Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/.../js/hook.js');
}
it is not ideal as this can influence the user experience.
global $DIC;
if ($a_comp == 'Services/Container' && (int)$_GET['ref_id'] === 1234) {
$DIC->globalScreen()->layout()->meta()->addJs('./Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/.../js/hook.js');
}
it is not ideal as this can influence the user experience.