Zend certified PHP/Magento developer

Custom confirmation pop-up to admin form “Save” button

I have a module with BlockAdminhtml files and in one of those files it adds the Save button as follows:

$this->buttonList->add(
    'save_and_continue_edit',
    [
        'class' => 'save',
        'label' => __('Save and Continue Edit'),
        'data_attribute' => [
            'mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']],
        ]
    ],
    10
);

I added 'onclick' => "alert('test')" there and it works,
now I need a little bit more complex logic for the confirmation, so my question is how can I define a JS function and make it available there? Like 'onclick' => "customConfirmFunction()" which can get the event and do e.preventDefault() if needed too.

This module also has a requirejs-config.js file with a map inside view/frontend but I’m pretty new in magento so no idea how it plays out.