In my experience, including a function inside a closure is one way to declare it "private" - such that nothing outside can access it. In addition, you should pay attention to the way to minimize the code:
Before:
(function() { function privateFn(var1, var2) {
After:
(function() { function _a(_0, _1) { } return { publicFn: function() { } } })();
Note that privateFn no longer exists? minifier knows, by definition, that nothing can access this function outside — by name or otherwise. You seem to want one of your features to be publicly available.
Katana314
source share