Share code between actions and elements in pluging

Hi people,

I am working on a plugin that contains actions and elements that all make use of the same javascript functions to make some financial calculations. Is there any way of defining these functions once and then using them across actions and elements? Seems inefficient and error prone to have to copy them across.

Your help would be highly appreciated!


You can put your code in a js file, add it to the plugin’s shared header, and it should be accessible everywhere.

Take a look at Minimum’s Studio Heroicons plugin – maybe it has been renamed to Zeroqode’s Heroicons plugin.

1 Like

Thank you Rico, that did the trick nicely!