how to extend ctools functions in my own js file? I am trying to extend the ctools model functions in my JavaScript file but not getting the exact way.

In ctool model.js contains modalContentClose = function(){close(); return false;}; which I want to override in my JavaScript file to add more functionality.

I have tried to use the following code, but it doesn't work.

function extends modalContentClose() {
  // Some alert here.
}
JavaScript doesn't allow extending a function with another one. If you want to extend modalContentClose() you just redefine it in your JavaScript file that is included after the JavaScript used by ctools.module.

modalContentClose = function() {
  // Add your own code.
  close();
  return false;
};


Your version of modalContentClose() cannot refer the previous modalContentClose(), if you don't save it in a new variable, as with the following code.

originalContentClose = modalContentClose;

modalContentClose = function() {
  // Add your own code.
  originalContentClose();
};