Zend certified PHP/Magento developer

How do I add onclick functionality to a custom button on admin side?

I am able to add a button to Product Listing page.
But how do I add onclick to it?

This is how I am adding the button:

$subject->addButton('amazon_sync_button',[
            'label' => __('Sync with Amazon'),
            'id' => 'amazon-sync-button',
            'on_click' => 'setLocation('' . $this->sync() . '')'
        ]);

I have created a function sync(), but this gets executed even before button click.

I saw some answer using getURL(), but I am not sure how to achieve it.
Can anyone guide me on how to do this?