Copy link to clipboard
Copied
Hello,
I'm wondering why my function gets called automatically when the script runs without me clicking on the menu item.
customMenuAction.addEventListener( "onInvoke", importTranslations(), false );
This runs everytime.
because you are actually calling the function in your script - adding () after the name of any function invokes that function.
your code should be:
customMenuAction.addEventListener( "onInvoke", importTranslations, false );
Copy link to clipboard
Copied
because you are actually calling the function in your script - adding () after the name of any function invokes that function.
your code should be:
customMenuAction.addEventListener( "onInvoke", importTranslations, false );