For some reason, I can only find examples of plugins that are directly related to an existing element, for example $ (selector) .myPlugin ();
What I want is just to simply call a new myPlugin () with parameters.
new myPlugin({ 'option1': 'option 1 value', 'option2': 'option 2 value', 'option3': 'option 3 value', 'option4': 'option 4 value' });
I have a regular function that has up to 8 parameters, but I don’t always need to define them, and I don’t like to include default values for all parameters that I don’t need to define.
function myFunction(param1, param2, param3, param4, param5, param6, param7, param8){
Sometimes I just need to define the first and fifth parameters or something else, and for the rest I need the default values. It is a pain.
Perhaps I missed an example similar to this in my searches.
Tomas source share