helpers are inside the plugin, which is an anonymous function, and you cannot access the variables declared inside it.
If you want to test it, leave the var keyword in front of the functions. This will declare the functions global (bind them to the window object), allowing them to be visible from the window area (by calling someHelperFunction or window.someHelperFunction ).
therefore for testing:
(function($) { someHelperFunction = function(s, d) { return s*d; } someOtherHelperFunction = function(s) { return s*2; }
after testing is complete, add the var keyword again.
Update
I think the best approach would be to group your tested functions in an object and build an api. Then, by the same principle, you can make api visible on a global scale or not:
(function($, global) { someHelperFunction = function(s, d) { return s*d; } someOtherHelperFunction = function(s) { return s*2; } var api = { someHelperFunction: someHelperFunction, someOtherHelperFunction: someOtherHelperFunction };
gion_13
source share