how to override a js function in api for wp plugin

I have to create a wp plugin that uses api provided by hero property management to show listings. I need to override a function that is in the api that shows single listing on onClick event in iframe. How to override that function a show the single listing in a new page/url.

The main js function in api is similar to this:
openListingFromSummary(‘listingId’, ‘listingDesc’);

I tried to override it using the following code:

var orig_openListingFromSummary = window.openListingFromSummary('TX055461L', '$1995/month 2 bedroom / 2.5 bathroom Single family');
window.openListingFromSummary = function(){
    orig_openListingFromSummary();
    alert('HI');
}

I want the orig_openListingFromSummary function to operate instead of previous openListingFromSummary