Is there an onCopy JS-Function to detect if a macro is copied or created?

I want to detect, if a user creates a macro or copy&paste it e.g. for changing a parameter.

The PSEUDOCODE below explain what I want to do by changing the parameter named “id”:

My Idea is to use “setMacroJsOverride()” in the resource file “my.js”

AJS.MacroBrowser.setMacroJsOverride("mymacro", {
   /* add "onCopy() Listener here*/ : 
           function (param) {
               var parameterField = AJS.MacroBrowser.ParameterFields["string"](/* Parameter ID. Is there a "getParamByName() "?*/, {});


               return /* what ever ? */;

Can someone help to replace the comments to turn the pseudocode into for working code?

Best Regards